Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Argument completion without description, Bash completion "menu complete" #2017

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

Conversation

jrohel
Copy link
Contributor

@jrohel jrohel commented Jan 23, 2025

Closes: #1990

  • Added support for suggesting arguments for completion without adding a description in cli:.ArgumentParser
  • Added support for suggesting command line arguments without descriptions in dnf5.
  • Added support for "menu completion" in bash completion.

Added methods for setting/getting whether to add a description
to suggested arguments on completion:
void set_complete_add_description(bool enable) noexcept;
bool get_complete_add_description() noexcept;
If the argument at position 1 is
`--complete=<index>[,add_description=1/0]`, this is a request
to complete the argument at position `<index>`.

Before, only `--complete=<index>` was used and the following text was
ignored. Now the optional `,add_description=1/0` is recognized, which
enables/disables the addition of a description to the proposed command
line arguments. By default, adding a description is enabled.
"Menu completion" cyclically completes the suggestions from the list.
We don't want to add a description to the added argument -> We need
a list of suggestions without descriptions.

"Normal completion" completes an identical part of the suggestions.
The added description is not printed. -> Descriptions can be
in the suggestion list, but will not be used. We can optimize the code
and not add the descriptions to the list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bash autocompletion adds command description to completed line
1 participant