Skip to content

Commit

Permalink
Updating input optinos
Browse files Browse the repository at this point in the history
  • Loading branch information
augustuswm committed Feb 3, 2019
1 parent 0a74d0d commit 9f01600
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
authors = ["Augustus Mayo <[email protected]>"]
edition = "2018"
name = "envfmt"
version = "0.1.0"
version = "0.2.0"
license = "Apache-2.0"

[badges]
Expand Down
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ pub fn main() -> Result<(), Box<dyn Error>> {
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)),
})
Expand Down
27 changes: 22 additions & 5 deletions src/opt.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Format>,
#[structopt(
name = "region",
long,
short,
help = "AWS region to query against. Defaults to us-east-1"
)]
pub region: Option<Region>,
}

Expand Down

0 comments on commit 9f01600

Please sign in to comment.