Skip to content

Commit

Permalink
fix: --version flag usage (#267)
Browse files Browse the repository at this point in the history
Some internal docs for `--verbose` were leaking into the usage output of
flox.
This PR removes an indirection used for the "fake" `--version` flag.

As a reminder; `--version` is handled separately from the main argument
handling,
so that it any flox command that contains `--version` will print the
version
and abort early in proper POSIX fashion.
That change also dropped the "Version: " prefix in the output of
`--version` which 713f45a reverts
  • Loading branch information
ysndr committed Sep 27, 2023
1 parent 77df7c4 commit 5677d70
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
7 changes: 3 additions & 4 deletions crates/flox/src/commands/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,10 @@ pub struct FloxArgs {
#[bpaf(long, req_flag(()), many, map(vec_not_empty))]
pub debug: bool,

/// With `--version` the application will print the version of the program
/// and quit early.
/// Print the version of the program
#[allow(dead_code)] // fake arg, `--version` is checked for separately (see [Version])
#[bpaf(external(version))]
version: Version,
#[bpaf(long)]
version: bool,

#[bpaf(external(commands), optional)]
command: Option<Commands>,
Expand Down
2 changes: 1 addition & 1 deletion crates/flox/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ async fn main() -> ExitCode {

// Quit early if `--version` is present
if Version::check() {
println!(env!("FLOX_VERSION"));
println!("Version: {}", env!("FLOX_VERSION"));
return ExitCode::from(0);
}

Expand Down

0 comments on commit 5677d70

Please sign in to comment.