Skip to content
New issue

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

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

Already on GitHub? # to your account

bash completion #58

Draft
wants to merge 25 commits into
base: main
Choose a base branch
from
Draft

Conversation

rjanalik
Copy link
Contributor

No description provided.

@rjanalik rjanalik force-pushed the feature/bash-completion branch from bc3db30 to db9077f Compare February 18, 2025 14:17
@rjanalik rjanalik force-pushed the feature/bash-completion branch from db9077f to d3cd2c2 Compare February 18, 2025 14:20
@rjanalik rjanalik force-pushed the feature/bash-completion branch from b2e1059 to 2e49f41 Compare February 18, 2025 23:01
@rjanalik rjanalik force-pushed the feature/bash-completion branch from 2e49f41 to f725244 Compare February 18, 2025 23:11
@rjanalik rjanalik force-pushed the feature/bash-completion branch from c42d470 to 6d815ef Compare February 25, 2025 18:49
Copy link
Member

@bcumming bcumming left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some small fixes.

To create the completions, use a sub-command instead of a flag:

uenv completion bash

This fits the uenv <verb> <options> model. Flags like --verbose or --color are optional information that influence actions.

};

struct global_settings {
using enum cli_mode;

int verbose = 0;
cli_mode mode = unset;
CLI::App* cli;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@bcumming I added this because I need a starting point to generate the completion script. Do you know how to get the pointer to CLI::App without adding it to the global_settings?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment in src/cli/completion.h with a suggestion for where to keep this information.

void completion_help();

struct completion_args {
std::string shell_description;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Store the CLI::App* in this type, and add a constructor ftakes the CLI::App* as an argument, instead of storing it in the main settings.

};

struct global_settings {
using enum cli_mode;

int verbose = 0;
cli_mode mode = unset;
CLI::App* cli;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left a comment in src/cli/completion.h with a suggestion for where to keep this information.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants