From 64c8aee7fbbaf4725adcb1bdef5e3faed9e8f79d Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 16 Mar 2018 23:51:41 +0100 Subject: [PATCH 1/2] Add functionality to include store path (defaults to no) --- bin/core/imag-ids/src/main.rs | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/bin/core/imag-ids/src/main.rs b/bin/core/imag-ids/src/main.rs index 98dd779b..30e0c49f 100644 --- a/bin/core/imag-ids/src/main.rs +++ b/bin/core/imag-ids/src/main.rs @@ -40,7 +40,7 @@ extern crate libimagstore; use std::io::Write; -use clap::App; +use clap::{Arg, App}; use libimagrt::setup::generate_runtime_setup; use libimagerror::trace::MapErrTrace; @@ -51,6 +51,12 @@ use libimagerror::io::ToExitCode; /// No special CLI pub fn build_ui<'a>(app: App<'a, 'a>) -> App<'a, 'a> { app + .arg(Arg::with_name("print-storepath") + .long("with-storepath") + .takes_value(false) + .required(false) + .multiple(false) + .help("Print the storepath for each id")) } fn main() { @@ -60,9 +66,16 @@ fn main() { "print all ids", build_ui); + let print_storepath = rt.cli().is_present("print-storepath"); + rt.store() .entries() .map_err_trace_exit_unwrap(1) + .map(|id| if print_storepath { + id + } else { + id.without_base() + }) .for_each(|id| { let _ = writeln!(rt.stdout(), "{}", id.to_str().map_err_trace_exit_unwrap(1)) .to_exit_code() From 323517c6a71f97a0065dec884a9607600f3205c3 Mon Sep 17 00:00:00 2001 From: Matthias Beyer Date: Fri, 16 Mar 2018 23:52:40 +0100 Subject: [PATCH 2/2] Add changelog entry for imag-ids not printing store path --- doc/src/09020-changelog.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/doc/src/09020-changelog.md b/doc/src/09020-changelog.md index 42c6da17..072d9009 100644 --- a/doc/src/09020-changelog.md +++ b/doc/src/09020-changelog.md @@ -41,6 +41,8 @@ This section contains the changelog from the last release to the next release. output as JSON. * `imag-edit` can now read store ids from stdin, sorts `imag ids | fzf | imag edit -I` is not a thing. + * `imag ids` does not print the path of the store. Can be turned on using + commandline flag. * Minor changes * A license-checker was included into the CI setup, which checks whether all ".rs"-files have the license header at the top of the file