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

Hide already used (non-multiple) options #104

Merged
merged 2 commits into from
Jul 11, 2023

Conversation

ZanyMonk
Copy link
Contributor

@ZanyMonk ZanyMonk commented Jun 21, 2023

Change only applied for options with multiple=False.

Before

> cmd <TAB>
                      --foo
                      --bar
> cmd --foo t <TAB>
                      --foo
                      --bar

After

> cmd <TAB>
                      --foo
                      --bar
> cmd --foo t <TAB>
                      --bar

@auvipy auvipy self-requested a review June 21, 2023 15:31
@ZanyMonk ZanyMonk changed the title Hide already used options Hide already used (non-multiple) options Jun 21, 2023
Copy link
Collaborator

@auvipy auvipy left a comment

Choose a reason for hiding this comment

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

please check the test failures

@GhostOps77
Copy link
Contributor

GhostOps77 commented Jun 22, 2023

This is made just to replicate the behaviour of the click's parsing style
if you've already supplied the values for the foo like -foo t, and if u supply it again like -foo R
then, foo's value will be overwritten as R from t

This is actually the intended way of behaviour

@ZanyMonk
Copy link
Contributor Author

ZanyMonk commented Jun 22, 2023

@auvipy please check your CI.

@GhostOps77 this PR does not disallow one to use an option multiple times, it just hides the ones already used from the completions, which makes it much more practical in my opinion (you don't have to sort through all the options you already added to the command).

I can make it optional if you prefer. If not, just remove the PR :)

@GhostOps77
Copy link
Contributor

GhostOps77 commented Jun 22, 2023

@ZanyMonk It's a linter error, format the code before committing
also, it would be better to have it as a flag to the completer class (via prompt kwargs) to decide whether to show already used non-multiple options or not

@ZanyMonk ZanyMonk requested a review from auvipy June 23, 2023 20:05
@ZanyMonk
Copy link
Contributor Author

Made it optional and fixed the format to fit flake8 test.

@auvipy auvipy merged commit 12adb3b into click-contrib:master Jul 11, 2023
32 checks passed
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.

None yet

3 participants