diff options
author | Justus Winter <justus@sequoia-pgp.org> | 2018-05-31 17:44:12 +0200 |
---|---|---|
committer | Justus Winter <justus@sequoia-pgp.org> | 2018-05-31 18:39:22 +0200 |
commit | 62f6d9bf5575dfc4621246acd532f3302ef9118e (patch) | |
tree | 507e64e8a3f5e228fa2cf30001e6758216364266 /tool | |
parent | d9dba05d734d15abb23a6db530fc3f90ddaa710c (diff) |
tool: Change store selection.
- Make --store a top-level flag, and give it the default 'default'.
Diffstat (limited to 'tool')
-rw-r--r-- | tool/src/cli.rs | 7 | ||||
-rw-r--r-- | tool/src/sq-usage.rs | 20 | ||||
-rw-r--r-- | tool/src/sq.rs | 3 |
3 files changed, 15 insertions, 15 deletions
diff --git a/tool/src/cli.rs b/tool/src/cli.rs index 64f69fa4..efb2136a 100644 --- a/tool/src/cli.rs +++ b/tool/src/cli.rs @@ -9,6 +9,10 @@ pub fn build() -> App<'static, 'static> { .long("domain") .short("d") .help("Sets the domain to use")) + .arg(Arg::with_name("store").value_name("STORE") + .long("store") + .short("s") + .help("Sets the store to use (default: 'default')")) .arg(Arg::with_name("policy").value_name("NETWORK-POLICY") .long("policy") .short("p") @@ -91,9 +95,6 @@ pub fn build() -> App<'static, 'static> { .help("Sets the input file to use")))) .subcommand(SubCommand::with_name("store") .about("Interacts with key stores") - .arg(Arg::with_name("name").value_name("NAME") - .required(true) - .help("Name of the store")) .subcommand(SubCommand::with_name("list") .about("Lists keys in the store")) .subcommand(SubCommand::with_name("add") diff --git a/tool/src/sq-usage.rs b/tool/src/sq-usage.rs index a9516d44..76add0e9 100644 --- a/tool/src/sq-usage.rs +++ b/tool/src/sq-usage.rs @@ -15,6 +15,7 @@ //! OPTIONS: //! -d, --domain <DOMAIN> Sets the domain to use //! -p, --policy <NETWORK-POLICY> Sets the network policy to use +//! -s, --store <STORE> Sets the store to use (default: 'default') //! //! SUBCOMMANDS: //! dearmor Removes ASCII Armor from a file @@ -239,15 +240,12 @@ //! Interacts with key stores //! //! USAGE: -//! sq store <NAME> [SUBCOMMAND] +//! sq store [SUBCOMMAND] //! //! FLAGS: //! -h, --help Prints help information //! -V, --version Prints version information //! -//! ARGS: -//! <NAME> Name of the store -//! //! SUBCOMMANDS: //! add Add a key identified by fingerprint //! delete Deletes bindings or stores @@ -265,7 +263,7 @@ //! Add a key identified by fingerprint //! //! USAGE: -//! sq store <NAME> add <LABEL> <FINGERPRINT> +//! sq store add <LABEL> <FINGERPRINT> //! //! FLAGS: //! -h, --help Prints help information @@ -282,7 +280,7 @@ //! Deletes bindings or stores //! //! USAGE: -//! sq store <NAME> delete [FLAGS] [LABEL] +//! sq store delete [FLAGS] [LABEL] //! //! FLAGS: //! -h, --help Prints help information @@ -299,7 +297,7 @@ //! Exports a key //! //! USAGE: -//! sq store <NAME> export [FLAGS] [OPTIONS] <LABEL> +//! sq store export [FLAGS] [OPTIONS] <LABEL> //! //! FLAGS: //! -A, --armor Write armored data to file @@ -319,7 +317,7 @@ //! Imports a key //! //! USAGE: -//! sq store <NAME> import [OPTIONS] <LABEL> +//! sq store import [OPTIONS] <LABEL> //! //! FLAGS: //! -h, --help Prints help information @@ -338,7 +336,7 @@ //! Lists keys in the store //! //! USAGE: -//! sq store <NAME> list +//! sq store list //! //! FLAGS: //! -h, --help Prints help information @@ -351,7 +349,7 @@ //! Lists the keystore log //! //! USAGE: -//! sq store <NAME> log [LABEL] +//! sq store log [LABEL] //! //! FLAGS: //! -h, --help Prints help information @@ -367,7 +365,7 @@ //! Get stats for the given label //! //! USAGE: -//! sq store <NAME> stats <LABEL> +//! sq store stats <LABEL> //! //! FLAGS: //! -h, --help Prints help information diff --git a/tool/src/sq.rs b/tool/src/sq.rs index a09a9ded..dd7b9b0e 100644 --- a/tool/src/sq.rs +++ b/tool/src/sq.rs @@ -58,6 +58,7 @@ fn real_main() -> Result<(), failure::Error> { }; let ctx = Context::configure(matches.value_of("domain").unwrap_or("org.sequoia-pgp.sq")) .network_policy(policy).build()?; + let store_name = matches.value_of("store").unwrap_or("default"); match matches.subcommand() { ("decrypt", Some(m)) => { @@ -133,7 +134,7 @@ fn real_main() -> Result<(), failure::Error> { } }, ("store", Some(m)) => { - let store = Store::open(&ctx, m.value_of("name").unwrap()) + let store = Store::open(&ctx, store_name) .context("Failed to open the store")?; match m.subcommand() { |