Skip to content

Commit

Permalink
Merge pull request skim-rs#489 from anthraxx/fix/clap-version-option
Browse files Browse the repository at this point in the history
  • Loading branch information
yazgoo authored Nov 8, 2022
2 parents 9def5d2 + 8b145ad commit 7b58296
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ unicode-width = "0.1.9"
log = "0.4.17"
env_logger = { version = "0.9.0", optional = true }
time = "0.3.13"
clap = { version = "3.2.22", optional = true }
clap = { version = "3.2.22", optional = true, features = ["cargo"] }
tuikit = "0.5.0"
vte = "0.11.0"
fuzzy-matcher = "0.3.7"
Expand Down
11 changes: 2 additions & 9 deletions src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,9 @@ use std::env;
use std::fs::File;
use std::io::{BufRead, BufReader, BufWriter, Write};

use clap::{App, Arg, ArgMatches};
use clap::{crate_version, App, Arg, ArgMatches};
use skim::prelude::*;

const VERSION: &str = env!("CARGO_PKG_VERSION");

const USAGE: &str = "
Usage: sk [options]
Expand Down Expand Up @@ -171,8 +169,8 @@ fn real_main() -> Result<i32, std::io::Error> {
// parse options
let opts = App::new("sk")
.author("Jinzhou Zhang<[email protected]>")
.version(crate_version!())
.arg(Arg::with_name("help").long("help").short('h'))
.arg(Arg::with_name("version").long("version").short('v'))
.arg(Arg::with_name("bind").long("bind").short('b').multiple(true).takes_value(true))
.arg(Arg::with_name("multi").long("multi").short('m').multiple(true))
.arg(Arg::with_name("no-multi").long("no-multi").multiple(true))
Expand Down Expand Up @@ -249,11 +247,6 @@ fn real_main() -> Result<i32, std::io::Error> {
return Ok(0);
}

if opts.is_present("version") {
writeln!(stdout, "{}", VERSION)?;
return Ok(0);
}

//------------------------------------------------------------------------------
let mut options = parse_options(&opts);

Expand Down

0 comments on commit 7b58296

Please sign in to comment.