[edk2-devel] [edk2-staging/EdkRepo] [PATCH V2 0/3] EdkRepo: Command completion in bash/zsh

Nate DeSimone posted 3 patches 4 years ago
Failed in applying to current master (apply log)
edkrepo/command_completion_edkrepo.py         |  87 ++++++
edkrepo/edkrepo_cli.py                        |  61 +++-
.../EdkRepoInstaller/InstallWorker.cs         | 212 +++++++++++--
.../EdkRepoInstaller/InstallerStrings.cs      |  44 ++-
.../Vendor/win_edkrepo_prompt.sh              |  60 ++++
edkrepo_installer/linux-scripts/install.py    | 285 +++++++++++++++++-
setup.py                                      |   8 +-
7 files changed, 730 insertions(+), 27 deletions(-)
create mode 100644 edkrepo/command_completion_edkrepo.py
create mode 100644 edkrepo_installer/Vendor/win_edkrepo_prompt.sh
[edk2-devel] [edk2-staging/EdkRepo] [PATCH V2 0/3] EdkRepo: Command completion in bash/zsh
Posted by Nate DeSimone 4 years ago
Changes since V1:
  - Now uses the new combinations_in_manifest() function
    introduced by Erik's patch series.

This patch series adds command completions (also referred to as
[TAB] completions) to EdkRepo. It also adds the currently
checked out branch combination to the command prompt. This is a
significant quality of life improvement for EdkRepo's users.

The bash and zsh shells are supported. The reason why bash and
zsh were choosen is based on their popularity in the UNIX world.
zsh is the default shell on macOS and most contemporary Linux
distributions use bash as the default shell. Git for Windows
also uses bash.

Performance was a strong consideration in the design of this
feature. Since EdkRepo has become a fairly large amount of
Python code with lots of dependencies, the "boot time" for
the Python interperter to load and execute the EdkRepo
entrypoint is approximately 1-2 seconds. A 2 second delay
on TAB completion would not be a good user experience.
To mitigate this, instead of enumerating and instantiating
all the command classes to generate the list of EdkRepo
sub-commands every time the user presses the TAB
key, this is done once and stored in a auto-generated shell
script at installation time. This way, the shell has all the
information needed for static completions without having
to invoke the Python interperter at all.

There are cases where TAB completions need some dynamic data.
For example, completing the 3rd parameter after
"edkrepo checkout " requires the shell to know the list of
branch combinations, this requires parsing the manifest XML.
command_completion_edkrepo.py provides a means for the shell
to get that type of data. A new command_completion_edkrepo.py
script has been added for this purpose.
command_completion_edkrepo.py is callable by the shell when
dynamic completion data is needed.
command_completion_edkrepo.py has been tuned to limit imports
as much as possible so that it executes quickly.

command_completion_edkrepo.py is also used to retrieve the
currently checked out branch combination so that it can be
added to the prompt. For performance considerations,
this operation is only done iff the present working directory
was changed by the last command the shell executed.

Cc: Ashley DeSimone <ashley.e.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Philippe Mathieu-Daude <philmd@redhat.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

Nate DeSimone (3):
  EdkRepo: Generate command completion scripts
  EdkRepo: Add command completion setup to install.py
  EdkRepo: Add command completion setup to Windows installer

 edkrepo/command_completion_edkrepo.py         |  87 ++++++
 edkrepo/edkrepo_cli.py                        |  61 +++-
 .../EdkRepoInstaller/InstallWorker.cs         | 212 +++++++++++--
 .../EdkRepoInstaller/InstallerStrings.cs      |  44 ++-
 .../Vendor/win_edkrepo_prompt.sh              |  60 ++++
 edkrepo_installer/linux-scripts/install.py    | 285 +++++++++++++++++-
 setup.py                                      |   8 +-
 7 files changed, 730 insertions(+), 27 deletions(-)
 create mode 100644 edkrepo/command_completion_edkrepo.py
 create mode 100644 edkrepo_installer/Vendor/win_edkrepo_prompt.sh

-- 
2.26.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56959): https://edk2.groups.io/g/devel/message/56959
Mute This Topic: https://groups.io/mt/72761906/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-

Re: [edk2-devel] [edk2-staging/EdkRepo] [PATCH V2 0/3] EdkRepo: Command completion in bash/zsh
Posted by Ashley E Desimone 4 years ago
For the series:

Reviewed-by: Ashley DeSimone <ashley.e.desimone@intel.com>

-----Original Message-----
From: Desimone, Nathaniel L <nathaniel.l.desimone@intel.com> 
Sent: Friday, April 3, 2020 4:49 PM
To: devel@edk2.groups.io
Cc: Desimone, Ashley E <ashley.e.desimone@intel.com>; Pandya, Puja <puja.pandya@intel.com>; Bjorge, Erik C <erik.c.bjorge@intel.com>; Agyeman, Prince <prince.agyeman@intel.com>; Bret Barkelew <Bret.Barkelew@microsoft.com>; Philippe Mathieu-Daude <philmd@redhat.com>
Subject: [edk2-staging/EdkRepo] [PATCH V2 0/3] EdkRepo: Command completion in bash/zsh

Changes since V1:
  - Now uses the new combinations_in_manifest() function
    introduced by Erik's patch series.

This patch series adds command completions (also referred to as [TAB] completions) to EdkRepo. It also adds the currently checked out branch combination to the command prompt. This is a significant quality of life improvement for EdkRepo's users.

The bash and zsh shells are supported. The reason why bash and zsh were choosen is based on their popularity in the UNIX world.
zsh is the default shell on macOS and most contemporary Linux distributions use bash as the default shell. Git for Windows also uses bash.

Performance was a strong consideration in the design of this feature. Since EdkRepo has become a fairly large amount of Python code with lots of dependencies, the "boot time" for the Python interperter to load and execute the EdkRepo entrypoint is approximately 1-2 seconds. A 2 second delay on TAB completion would not be a good user experience.
To mitigate this, instead of enumerating and instantiating all the command classes to generate the list of EdkRepo sub-commands every time the user presses the TAB key, this is done once and stored in a auto-generated shell script at installation time. This way, the shell has all the information needed for static completions without having to invoke the Python interperter at all.

There are cases where TAB completions need some dynamic data.
For example, completing the 3rd parameter after "edkrepo checkout " requires the shell to know the list of branch combinations, this requires parsing the manifest XML.
command_completion_edkrepo.py provides a means for the shell to get that type of data. A new command_completion_edkrepo.py script has been added for this purpose.
command_completion_edkrepo.py is callable by the shell when dynamic completion data is needed.
command_completion_edkrepo.py has been tuned to limit imports as much as possible so that it executes quickly.

command_completion_edkrepo.py is also used to retrieve the currently checked out branch combination so that it can be added to the prompt. For performance considerations, this operation is only done iff the present working directory was changed by the last command the shell executed.

Cc: Ashley DeSimone <ashley.e.desimone@intel.com>
Cc: Puja Pandya <puja.pandya@intel.com>
Cc: Erik Bjorge <erik.c.bjorge@intel.com>
Cc: Prince Agyeman <prince.agyeman@intel.com>
Cc: Bret Barkelew <Bret.Barkelew@microsoft.com>
Cc: Philippe Mathieu-Daude <philmd@redhat.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desimone@intel.com>

Nate DeSimone (3):
  EdkRepo: Generate command completion scripts
  EdkRepo: Add command completion setup to install.py
  EdkRepo: Add command completion setup to Windows installer

 edkrepo/command_completion_edkrepo.py         |  87 ++++++
 edkrepo/edkrepo_cli.py                        |  61 +++-
 .../EdkRepoInstaller/InstallWorker.cs         | 212 +++++++++++--
 .../EdkRepoInstaller/InstallerStrings.cs      |  44 ++-
 .../Vendor/win_edkrepo_prompt.sh              |  60 ++++
 edkrepo_installer/linux-scripts/install.py    | 285 +++++++++++++++++-
 setup.py                                      |   8 +-
 7 files changed, 730 insertions(+), 27 deletions(-)  create mode 100644 edkrepo/command_completion_edkrepo.py
 create mode 100644 edkrepo_installer/Vendor/win_edkrepo_prompt.sh

--
2.26.0.windows.1


-=-=-=-=-=-=-=-=-=-=-=-
Groups.io Links: You receive all messages sent to this group.

View/Reply Online (#56992): https://edk2.groups.io/g/devel/message/56992
Mute This Topic: https://groups.io/mt/72761906/1787277
Group Owner: devel+owner@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [importer@patchew.org]
-=-=-=-=-=-=-=-=-=-=-=-