diff --git a/Cargo.toml b/Cargo.toml index 933f310..c49b340 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -2,7 +2,7 @@ authors = ["Augustus Mayo "] edition = "2018" name = "envfmt" -version = "0.1.0" +version = "0.2.0" license = "Apache-2.0" [badges] diff --git a/src/main.rs b/src/main.rs index ea9d7b1..d6fe235 100644 --- a/src/main.rs +++ b/src/main.rs @@ -40,7 +40,7 @@ pub fn main() -> Result<(), Box> { let client = SsmClient::new(opt.region.unwrap_or(Region::default())); let bag = get_all_params_for_path(&client, &opt.path)?; - Ok(match opt.format { + Ok(match opt.format.unwrap_or(Format::DotEnv) { Format::DotEnv => print!("{}", DotEnv::from(bag)), Format::PhpFpm => print!("{}", PhpFpm::from(bag)), }) diff --git a/src/opt.rs b/src/opt.rs index a6a2833..3ea9d4b 100644 --- a/src/opt.rs +++ b/src/opt.rs @@ -5,15 +5,32 @@ use std::fmt; use std::str::FromStr; #[derive(Debug, StructOpt)] -#[structopt(name = "envfmt", about = "Fetches env parameters from SSM")] -#[structopt(raw(setting = "structopt::clap::AppSettings::ColoredHelp"))] +#[structopt( + name = "envfmt", + author = "", + about = "Fetches env parameters from SSM" +)] +#[structopt( + raw(setting = "structopt::clap::AppSettings::ColoredHelp"), + raw(setting = "structopt::clap::AppSettings::ArgRequiredElseHelp") +)] pub struct EnvFmtOpts { /// Path prefix to select parameters for pub path: String, /// Format to output results as - #[structopt(raw(possible_values = "&[&\"dot-env\", &\"php-fpm\"]"))] - pub format: Format, - #[structopt(name = "region", long, short)] + #[structopt( + raw(possible_values = "&[&\"dot-env\", &\"php-fpm\"]"), + name = "format", + long, + short + )] + pub format: Option, + #[structopt( + name = "region", + long, + short, + help = "AWS region to query against. Defaults to us-east-1" + )] pub region: Option, }