Merge pull request #1377 from matthiasbeyer/imag-contact/find-id

imag-contact: Add functionality to find contacts and print the storeid/file path
This commit is contained in:
Matthias Beyer 2018-04-07 10:51:02 +02:00 committed by GitHub
commit a14ab7b635
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 38 additions and 0 deletions

View file

@ -305,6 +305,21 @@ fn find(rt: &Runtime) {
::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 {
iterator
.for_each(|(i, (fle, card))| {

View file

@ -129,6 +129,29 @@ pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> {
.conflicts_with("find-show")
.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")