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.desim...@intel.com>
Cc: Puja Pandya <puja.pan...@intel.com>
Cc: Erik Bjorge <erik.c.bjo...@intel.com>
Cc: Prince Agyeman <prince.agye...@intel.com>
Cc: Bret Barkelew <bret.barke...@microsoft.com>
Cc: Philippe Mathieu-Daude <phi...@redhat.com>
Signed-off-by: Nate DeSimone <nathaniel.l.desim...@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         |  86 ++++++
 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, 729 insertions(+), 27 deletions(-)
 create mode 100644 edkrepo/command_completion_edkrepo.py
 create mode 100644 edkrepo_installer/Vendor/win_edkrepo_prompt.sh

-- 
2.24.0.windows.2


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

View/Reply Online (#56876): https://edk2.groups.io/g/devel/message/56876
Mute This Topic: https://groups.io/mt/72713332/21656
Group Owner: devel+ow...@edk2.groups.io
Unsubscribe: https://edk2.groups.io/g/devel/unsub  [arch...@mail-archive.com]
-=-=-=-=-=-=-=-=-=-=-=-

Reply via email to