Skip to content

Commit

Permalink
Merge pull request #269 from lotabout/ticket-219
Browse files Browse the repository at this point in the history
Ticket 219
  • Loading branch information
lotabout authored Feb 23, 2020
2 parents 29239ba + 3edc75d commit 7223980
Show file tree
Hide file tree
Showing 20 changed files with 1,001 additions and 728 deletions.
6 changes: 3 additions & 3 deletions Cargo.lock

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

5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,7 @@ path = "src/lib.rs"

[[bin]]
name = "sk"
path = "src/main.rs"

path = "src/bin/main.rs"

[dependencies]
nix = "0.14.0"
Expand All @@ -32,7 +31,7 @@ time = "0.1.38"
clap = "2.26.2"
tuikit = "0.3.1"
vte = "0.3.3"
fuzzy-matcher = "0.3.3"
fuzzy-matcher = "0.3.4"
rayon = "1.0.3"
derive_builder = "0.9"
bitflags = "1.0.4"
Expand Down
10 changes: 9 additions & 1 deletion src/main.rs → src/bin/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ extern crate time;
use clap::{App, Arg, ArgMatches};
use nix::unistd::isatty;
use skim::{
read_and_collect_from_command, CollectorInput, CollectorOption, FuzzyAlgorithm, Skim, SkimOptions,
read_and_collect_from_command, CaseMatching, CollectorInput, CollectorOption, FuzzyAlgorithm, Skim, SkimOptions,
SkimOptionsBuilder,
};
use std::env;
Expand Down Expand Up @@ -37,6 +37,8 @@ Usage: sk [options]
--regex use regex instead of fuzzy match
--algo=TYPE Fuzzy matching algorithm:
[skim_v1|skim_v2|clangd] (default: skim_v2)
--case [respect,ignore,smart] (default: smart)
case sensitive or not
Interface
-b, --bind KEYBINDS comma seperated keybindings, in KEY:ACTION
Expand Down Expand Up @@ -190,6 +192,7 @@ fn real_main() -> i32 {
.arg(Arg::with_name("reverse").long("reverse").multiple(true))

.arg(Arg::with_name("algorithm").long("algo").multiple(true).takes_value(true).default_value("skim_v2"))
.arg(Arg::with_name("case").long("case").multiple(true).takes_value(true).default_value("smart"))
.arg(Arg::with_name("literal").long("literal").multiple(true))
.arg(Arg::with_name("cycle").long("cycle").multiple(true))
.arg(Arg::with_name("no-hscroll").long("no-hscroll").multiple(true))
Expand Down Expand Up @@ -334,6 +337,11 @@ fn parse_options<'a>(options: &'a ArgMatches) -> SkimOptions<'a> {
.algorithm(FuzzyAlgorithm::of(
options.values_of("algorithm").and_then(|vals| vals.last()).unwrap(),
))
.case(match options.value_of("case") {
Some("smart") => CaseMatching::Smart,
Some("ignore") => CaseMatching::Ignore,
_ => CaseMatching::Respect,
})
.build()
.unwrap()
}
Loading

0 comments on commit 7223980

Please sign in to comment.