Add functionality to find contacts and print the storeid/file path
This commit is contained in:
parent
2cee4ba90f
commit
3dfb17aabd
2 changed files with 38 additions and 0 deletions
|
@ -305,6 +305,21 @@ fn find(rt: &Runtime) {
|
||||||
::std::process::exit(1)
|
::std::process::exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} else if scmd.is_present("find-id") {
|
||||||
|
iterator
|
||||||
|
.for_each(|(_i, (fle, _card))| {
|
||||||
|
writeln!(rt.stdout(), "{}", fle.get_location())
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
|
})
|
||||||
|
} else if scmd.is_present("find-full-id") {
|
||||||
|
let storepath = rt.store().path().display();
|
||||||
|
iterator
|
||||||
|
.for_each(|(_i, (fle, _card))| {
|
||||||
|
writeln!(rt.stdout(), "{}/{}", storepath, fle.get_location())
|
||||||
|
.to_exit_code()
|
||||||
|
.unwrap_or_exit();
|
||||||
|
})
|
||||||
} else {
|
} else {
|
||||||
iterator
|
iterator
|
||||||
.for_each(|(i, (fle, card))| {
|
.for_each(|(i, (fle, card))| {
|
||||||
|
|
|
@ -129,6 +129,29 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
|
||||||
.conflicts_with("find-show")
|
.conflicts_with("find-show")
|
||||||
.conflicts_with("find-list"))
|
.conflicts_with("find-list"))
|
||||||
|
|
||||||
|
.arg(Arg::with_name("find-id")
|
||||||
|
.long("id")
|
||||||
|
.takes_value(false)
|
||||||
|
.required(false)
|
||||||
|
.multiple(false)
|
||||||
|
.help("Print the store ids of the found entries")
|
||||||
|
.conflicts_with("find-full-id")
|
||||||
|
.conflicts_with("json")
|
||||||
|
.conflicts_with("find-show")
|
||||||
|
.conflicts_with("find-list"))
|
||||||
|
|
||||||
|
.arg(Arg::with_name("find-full-id")
|
||||||
|
.long("full-id")
|
||||||
|
.takes_value(false)
|
||||||
|
.required(false)
|
||||||
|
.multiple(false)
|
||||||
|
.help("Print the path to the file in the store of the found entries")
|
||||||
|
.conflicts_with("find-id")
|
||||||
|
.conflicts_with("json")
|
||||||
|
.conflicts_with("find-show")
|
||||||
|
.conflicts_with("find-list"))
|
||||||
|
|
||||||
|
|
||||||
)
|
)
|
||||||
|
|
||||||
.subcommand(SubCommand::with_name("create")
|
.subcommand(SubCommand::with_name("create")
|
||||||
|
|
Loading…
Reference in a new issue