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

--hidden flag is not idempotent #488

Closed
laur89 opened this issue Sep 26, 2019 · 4 comments · Fixed by #496
Closed

--hidden flag is not idempotent #488

laur89 opened this issue Sep 26, 2019 · 4 comments · Fixed by #496

Comments

@laur89
Copy link

laur89 commented Sep 26, 2019

Creating an alias for fd providing the --hidden flag has been recommended here for numerous times.

I did that, but now am seeing problems when another shell abstraction (eg fzf's FZF_DEFAULT_COMMAND env var) is providing --hidden as well, causing fd command to end up with multiple --hidden flags, resulting in

error: The argument '--hidden' was provided more than once, but cannot be used multiple times

error. Now, said command could bypass alias by prefixing fd with command (at least in bash), but generally such flags are allowed to be provided many times.

Is there a reason for current behavior?

Running ver 7.0.0

@sharkdp
Copy link
Owner

sharkdp commented Sep 30, 2019

Thank you for the feedback!

Is there a reason for current behavior?

No. We should change it. This should be easy to implement. We need to use claps overrides_with option:

arg("hidden").long("hidden").short("H").overrides_with("hidden")

This should probably also be done for some other similar arguments.

rootbid added a commit to rootbid/fd that referenced this issue Oct 2, 2019
Preven fd to end up with multiple --hidden flags
Fixes sharkdp#488
@rootbid
Copy link
Contributor

rootbid commented Oct 2, 2019

I am hoping this resolves the reported issue.
@sharkdp, you also mentioned overriding some other similar arguments. Can you name those arguments for me to implement?

@sharkdp
Copy link
Owner

sharkdp commented Oct 6, 2019

@rootbid Thank you for looking into this. Similar arguments would essentially be all flags (the ones which do not take values):

  • --no-ignore
  • --no-ignore-vcs
  • --case-sensitive
  • --ignore-case
  • --glob
  • --regex
  • --fixed-strings
  • --absolute-path
  • --follow
  • --full-path
  • --print0
  • --show-errors

Care must be taken that --ignore-case still overwrites with --case-sensitive and similar restrictions.

rootbid added a commit to rootbid/fd that referenced this issue Oct 8, 2019
Add 'overrides_with' to format flags. Resolves sharkdp#488
rootbid added a commit to rootbid/fd that referenced this issue Oct 8, 2019
Add 'overrides_with' to format flags.
Resolves sharkdp#488
sharkdp pushed a commit that referenced this issue Oct 9, 2019
Add 'overrides_with' to format flags.
Resolves #488
@sharkdp
Copy link
Owner

sharkdp commented Mar 22, 2020

Released in fd 7.5.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants