added path flag
This commit is contained in:
parent
c99ef1a7b0
commit
9456983536
3 changed files with 17 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
[package]
|
||||
name = "open"
|
||||
version = "0.3.0"
|
||||
version = "0.3.1"
|
||||
authors = ["Valerie Wolfe <sleeplessval@gmail.com>"]
|
||||
edition = "2018"
|
||||
|
||||
|
|
|
@ -9,8 +9,8 @@ use configparser::ini::Ini;
|
|||
pub struct Config {
|
||||
pub local: Option<Ini>,
|
||||
pub global: Option<Ini>,
|
||||
local_path: Option<String>,
|
||||
global_path: Option<String>
|
||||
pub local_path: Option<String>,
|
||||
pub global_path: Option<String>
|
||||
}
|
||||
|
||||
impl Config {
|
||||
|
|
17
src/main.rs
17
src/main.rs
|
@ -30,8 +30,9 @@ USAGE:
|
|||
open [FLAGS] [OPERAND]
|
||||
|
||||
FLAGS:
|
||||
-h, --help Prints this help text
|
||||
-a, --add Add a handler for a operand type
|
||||
-h, --help Prints this help text
|
||||
-a, --add Add a handler for a operand type
|
||||
-p, --path Prints the config path used
|
||||
");
|
||||
return;
|
||||
},
|
||||
|
@ -52,7 +53,17 @@ FLAGS:
|
|||
}
|
||||
config.write().ok();
|
||||
return;
|
||||
}
|
||||
},
|
||||
"-p" |
|
||||
"--path" => {
|
||||
let local = config.local_path;
|
||||
if local.is_some() {
|
||||
println!("{}", local.unwrap());
|
||||
} else {
|
||||
println!("{}", config.global_path.unwrap());
|
||||
}
|
||||
return;
|
||||
},
|
||||
_ => {
|
||||
if file_operand {
|
||||
error = Some("open: too many file operands.".to_string());
|
||||
|
|
Loading…
Reference in a new issue