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

Add opposing CLI options #822

Merged
merged 8 commits into from
Nov 14, 2021
Merged

Conversation

Asha20
Copy link
Contributor

@Asha20 Asha20 commented Aug 9, 2021

Closes #595

I've implemented the 5 opposing options mentioned in the issue. Those are:

  • --no-hidden, which overrides --hidden
  • --ignore, which overrides --no-ignore
  • --ignore-vcs, which overrides --no-ignore-vcs
  • --no-follow, which overrides --follow
  • --relative-path, which overrides --absolute-path

Those are:
  - `--no-hidden`, which overrides `--hidden`
  - `--ignore`, which overrides `--no-ignore`
  - `--ignore-vcs`, which overrides `--no-ignore-vcs`
  - `--no-follow`, which overrides `--follow`
  - `--relative-path`, which overrides `--absolute-path`
@tmccombs
Copy link
Collaborator

tmccombs commented Aug 9, 2021

Looks like builds are failing

@Asha20
Copy link
Contributor Author

Asha20 commented Aug 10, 2021

Yes, the error is:

error: failed to select a version for `version_check`.
Error:     ... required by package `test-case v1.2.0`
    ... which is depended on by `fd-find v8.2.1 (/project)`
versions that meet the requirements `^0.9.2` are: 0.9.3, 0.9.2

all possible versions conflict with previously selected packages.

  previously selected package `version_check v0.9.1`
    ... which is depended on by `fd-find v8.2.1 (/project)`

failed to select a version for `version_check` which could resolve this conflict

...which is puzzling to me since Cargo.toml has

version_check = "0.9"

while Cargo.lock has

[[package]]
name = "version_check"
version = "0.9.3"

so it should be working fine I think? I'm pretty new to Rust so honestly, I don't know how to resolve this error myself.

@tmccombs
Copy link
Collaborator

Huh... I can take a closer look later today

src/app.rs Outdated
.arg(
Arg::with_name("no-hidden")
.long("no-hidden")
.overrides_with("no-hidden")
Copy link
Owner

Choose a reason for hiding this comment

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

Shouldn't it also override --hidden? We don't want --hidden and --no-hidden to be present at the same time, right? This way, you might even be able to simplify the logic in main.rs (not completely sure).

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I thought we did want to support both of them being present; at least that's the use case mentioned in the original issue here with aliasing.

Copy link
Owner

Choose a reason for hiding this comment

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

Ah, yes. Sorry for that. My comment was confusing. What I meant was: I think we can let clap help us here. If we set no-hidden "overrides_with" hidden, I think that clap internally either has "hidden" or "no-hidden" present, never both.

We definitely want the user to be able to pass both of them.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah, I see what you mean now. Yep, I think that'll clean up main.rs a bit.

src/app.rs Outdated
@@ -25,7 +25,17 @@ pub fn build_app() -> App<'static, 'static> {
.long_help(
"Include hidden directories and files in the search results (default: \
hidden files and directories are skipped). Files and directories are \
considered to be hidden if their name starts with a `.` sign (dot).",
considered to be hidden if their name starts with a `.` sign (dot). \
Flag can be overridden with --no-hidden.",
Copy link
Owner

Choose a reason for hiding this comment

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

Minor: for the long help text, can we please use full sentences ("The flag can be ...").

Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

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

Thank you very much for your contribution. Can we please update the man page as well?

@Asha20
Copy link
Contributor Author

Asha20 commented Aug 22, 2021

Sure thing, I'll update it a bit later.

@Asha20 Asha20 requested a review from sharkdp August 23, 2021 13:58
@sharkdp sharkdp added this to the fd 8.3 milestone Nov 14, 2021
Copy link
Owner

@sharkdp sharkdp left a comment

Choose a reason for hiding this comment

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

Thank you for the updates!

@sharkdp sharkdp merged commit a539181 into sharkdp:master Nov 14, 2021
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.

Opposing/negating command-line options (eg. --no-hidden)
3 participants