-
-
Notifications
You must be signed in to change notification settings - Fork 817
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
feat: Add option to always include cwd prefix #1445
Conversation
src/cli.rs
Outdated
overrides_with("strip_cwd_prefix"), | ||
long_help | ||
)] | ||
pub cwd_prefix: bool, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Alternatively, I could change the --strip-cwd-prefix
option to take an enum value that is one of "always", "never", and "auto" (current default behavior). Although in that case I would want to treat it being given without a value as always
. I'm not sure if clap can handle that.
Not sure if this was mentioned in the linked issues, but it is already possible to get the leading $ fd . .
./cli.rs
./config.rs
...
$ fd --search-path .
./cli.rs
./config.rs
... |
6567b29
to
9cbf494
Compare
-X/--exec-batch, or -0/--print0 are given, to reduce the risk of a | ||
path starting with '-' being treated as a command line option. Use | ||
this flag to change this behavior. If htis flag is used without a value, | ||
it is equivalent to passing "always". Possible values are: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would have expected "auto" here, since it is described as the default behavior below?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Making it equivalent to always makes it simpler to turn it on. And I think that having --strip-cwd-prefix
without a specific when value meaning "auto" instead of "always" could be confusing since it reals like it is always stripping the prefix.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, using always
if this is used without an argument is more backwards compatible with existing usage of the argument.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the thing that confused me was that "auto" is described as "Use the default behavior" below. And I misinterpreted that as "auto = do whatever you do when no argument is given". After re-reading everything, it still seems a bit strange to me, but I agree that always
makes sense as a default.
Thank you for the update |
Fixes: #1243
Fixes: #1331