This commit is contained in:
Ferran Basora 2019-02-25 23:04:14 +00:00
parent 5a0226fc63
commit 5002e5643f

View File

@ -29,31 +29,32 @@ fn app_args<'a> () -> clap::ArgMatches<'a> {
.arg(Arg::with_name("alphabet") .arg(Arg::with_name("alphabet")
.help("Sets the alphabet") .help("Sets the alphabet")
.long("alphabet") .long("alphabet")
.takes_value(true)) .short("a")
.default_value("qwerty"))
.arg(Arg::with_name("foreground_color") .arg(Arg::with_name("foreground_color")
.help("Sets the foregroud color for matches") .help("Sets the foregroud color for matches")
.long("fg-color") .long("fg-color")
.takes_value(true)) .default_value("green"))
.arg(Arg::with_name("background_color") .arg(Arg::with_name("background_color")
.help("Sets the background color for matches") .help("Sets the background color for matches")
.long("bg-color") .long("bg-color")
.takes_value(true)) .default_value("black"))
.arg(Arg::with_name("hint_foreground_color") .arg(Arg::with_name("hint_foreground_color")
.help("Sets the foregroud color for hints") .help("Sets the foregroud color for hints")
.long("hint-fg-color") .long("hint-fg-color")
.takes_value(true)) .default_value("yellow"))
.arg(Arg::with_name("hint_background_color") .arg(Arg::with_name("hint_background_color")
.help("Sets the background color for hints") .help("Sets the background color for hints")
.long("hint-bg-color") .long("hint-bg-color")
.takes_value(true)) .default_value("black"))
.arg(Arg::with_name("select_foreground_color")
.help("Sets the foregroud color for selection")
.long("select-fg-color")
.default_value("blue"))
.arg(Arg::with_name("reverse") .arg(Arg::with_name("reverse")
.help("Reverse the order for assigned hints") .help("Reverse the order for assigned hints")
.long("reverse") .long("reverse")
.short("r")) .short("r"))
.arg(Arg::with_name("select_foreground_color")
.help("Sets the foregroud color for selection")
.long("select-fg-color")
.takes_value(true))
.arg(Arg::with_name("unique") .arg(Arg::with_name("unique")
.help("Don't show duplicated hints for the same match") .help("Don't show duplicated hints for the same match")
.long("unique") .long("unique")
@ -63,15 +64,15 @@ fn app_args<'a> () -> clap::ArgMatches<'a> {
fn main() { fn main() {
let args = app_args(); let args = app_args();
let alphabet = args.value_of("alphabet").unwrap_or("querty"); let alphabet = args.value_of("alphabet").unwrap();
let reverse = args.is_present("reverse"); let reverse = args.is_present("reverse");
let unique = args.is_present("unique"); let unique = args.is_present("unique");
let foreground_color = colors::get_color(args.value_of("foreground_color").unwrap_or("green")); let foreground_color = colors::get_color(args.value_of("foreground_color").unwrap());
let background_color = colors::get_color(args.value_of("background_color").unwrap_or("black")); let background_color = colors::get_color(args.value_of("background_color").unwrap());
let hint_foreground_color = colors::get_color(args.value_of("hint_foreground_color").unwrap_or("yellow")); let hint_foreground_color = colors::get_color(args.value_of("hint_foreground_color").unwrap());
let hint_background_color = colors::get_color(args.value_of("hint_background_color").unwrap_or("black")); let hint_background_color = colors::get_color(args.value_of("hint_background_color").unwrap());
let select_foreground_color = colors::get_color(args.value_of("select_foreground_color").unwrap_or("blue")); let select_foreground_color = colors::get_color(args.value_of("select_foreground_color").unwrap());
let execution = exec_command(format!("tmux capture-pane -e -J -p")); let execution = exec_command(format!("tmux capture-pane -e -J -p"));
let output = String::from_utf8_lossy(&execution.stdout); let output = String::from_utf8_lossy(&execution.stdout);