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

FR: Allow creating default flags per command #2621

Closed
matts1 opened this issue Nov 23, 2023 · 1 comment
Closed

FR: Allow creating default flags per command #2621

matts1 opened this issue Nov 23, 2023 · 1 comment

Comments

@matts1
Copy link
Collaborator

matts1 commented Nov 23, 2023

Is your feature request related to a problem? Please describe.
I often want to set a default set of options to use for a command. For example:

  • rebase --skip-empty
  • log --no-pager (I like paging for diffs but not for logs)

This can currently be achieved via an alias, but you cannot alias an existing command to something (eg. log = ["log", "--no-pager"]).

Describe the solution you'd like

[command-defaults.log]
pager = false

[command-defaults.rebase]
skip_empty = true

We'd then simply modify clap to use defaults from a function instead of a static value (which appears to be possible - clap-rs/clap#1634 (comment))

Describe alternatives you've considered
Aliasing log to log could work, and might be simpler to implement, but what does the following do:

[aliases]
log = ["log", "--no-pager"]
log-head = ["log", "@"]

In this scenario, it's unclear whether we should use log --no-pager @ or log @.

@martinvonz
Copy link
Owner

This is a duplicate of the closed #1509. See the explanation there, but feel free to comment there (or here) if you think we missed anything.

@ilyagr ilyagr closed this as not planned Won't fix, can't repro, duplicate, stale Nov 23, 2023
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

No branches or pull requests

3 participants