Rework the setup-completion command to be more generally useful.

Review Request #13068 — Created May 25, 2023 and submitted — Latest diff uploaded

Information

RBTools
release-5.x

Reviewers

The setup-completion command has been around for a while, but it's
become less useful with time. It made an attempt to write completion
files to system directories for Linux or macOS, leaving Windows out, and
in fact leaving macOS out since system directories can't be written to.

Looking into what it would take to write these files safely to local
directories, it seems to be a mess, depending on bash/zsh versions,
distros, and configurations (e.g., Oh-My-ZSH vs. native ZSH setups).

Looking at some other completion-generator commands (npm, pip, and
pyenv), it seems that most don't bother trying to write and instead
leave it up to the user to place the code in the right place.

Given options, outputting the code is the best way to go, and has the
advantage of simplifying code considerably.

Documentation has been updated to walk users through configuring this.

Tested the auto-completion scripts with Bash and Zsh.

Tested default shell detection.

Tested using --json to get the script.

Built the docs. Read through them and checked for bad links, build
errors, and spelling errors.

Diff Revision 2 (Latest)

orig
1
2

Commits

First Last Summary ID Author
Rework the setup-completion command to be more generally useful.
The `setup-completion` command has been around for a while, but it's become less useful with time. It made an attempt to write completion files to system directories for Linux or macOS, leaving Windows out, and in fact leaving macOS out since system directories can't be written to. Looking into what it would take to write these files safely to local directories, it seems to be a mess, depending on bash/zsh versions, distros, and configurations (e.g., Oh-My-ZSH vs. native ZSH setups). Looking at some other completion-generator commands (npm, pip, and pyenv), it seems that most don't bother trying to write and instead leave it up to the user to place the code in the right place. Given options, outputting the code is the best way to go, and has the advantage of simplifying code considerably. Documentation has been updated to walk users through configuring this.
3f65f0718de4eaedb3f89ed37913e18e42f7f7e0 Christian Hammond
docs/rbtools/rbt/commands/setup-completion.rst
rbtools/commands/setup_completion.py
rbtools/commands/conf/rbt-bash-completion
rbtools/commands/conf/_rbt-zsh-completion
rbtools/commands/tests/test_setup_completion.py
Loading...