summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2018-04-07 10:51:02 +0200
committerGitHub <noreply@github.com>2018-04-07 10:51:02 +0200
commita14ab7b6354e3916ac15f1e3b63d2b540db5d7d8 (patch)
treef82f232ef038def179135e3662d7c1ec1ada6f3a
parent1d5171d77018b6e07a880db6826b5ccd690ed6f9 (diff)
parent3dfb17aabdfbd10d7142c63b79493095d2439064 (diff)
downloadimag-a14ab7b6354e3916ac15f1e3b63d2b540db5d7d8.zip
imag-a14ab7b6354e3916ac15f1e3b63d2b540db5d7d8.tar.gz
Merge pull request #1377 from matthiasbeyer/imag-contact/find-id
imag-contact: Add functionality to find contacts and print the storeid/file path
-rw-r--r--bin/domain/imag-contact/src/main.rs15
-rw-r--r--bin/domain/imag-contact/src/ui.rs23
2 files changed, 38 insertions, 0 deletions
diff --git a/bin/domain/imag-contact/src/main.rs b/bin/domain/imag-contact/src/main.rs
index e8dda55..e277dcf 100644
--- a/bin/domain/imag-contact/src/main.rs
+++ b/bin/domain/imag-contact/src/main.rs
@@ -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))| {
diff --git a/bin/domain/imag-contact/src/ui.rs b/bin/domain/imag-contact/src/ui.rs
index 3a22a65..6e63729 100644
--- a/bin/domain/imag-contact/src/ui.rs
+++ b/bin/domain/imag-contact/src/ui.rs
@@ -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")