Skip to content

Commit

Permalink
refactor: minor style and doc improvements (#16)
Browse files Browse the repository at this point in the history
  • Loading branch information
eegli authored Apr 16, 2023
1 parent 32483e2 commit 13da28e
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ aws_secret_access_key=iqVoWOI8+l6WVBn8pdCc/JxJ6
aws_session_token=IQoJb3JpZ2luXS4VhObxKg6p79Pm38C4ahGqcGKw==
```

Whenever you run an operation, **mfaws** checks your existing short-term profiles to see if there is still a valid (i.e., not yet expired) profile around. If that is the case, the operation is gracefully aborted and you'll be notified.
Whenever you run an operation, **mfaws** checks your existing short-term profiles to see if there is still a valid (i.e., not yet expired) profile around. If that is the case, the operation is gracefully aborted and you'll be notified. You can also force new credentials by passing the `--force` flag.

## Shell Aliases

Expand Down
4 changes: 2 additions & 2 deletions src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ pub struct Cli {
pub config: Config,
}

pub fn parse() -> anyhow::Result<(SubCommand, Config)> {
pub fn parse() -> (SubCommand, Config) {
let cli = Cli::parse();
Ok((cli.command, cli.config))
(cli.command, cli.config)
}
20 changes: 10 additions & 10 deletions src/creds.rs
Original file line number Diff line number Diff line change
Expand Up @@ -297,11 +297,11 @@ mod test_short_term_profile {
let section = handler.ini.section(Some(profile_name)).unwrap();

assert!(section.contains_key(ShortTermProfile::ASSUMED_ROLE_ARN));
assert!(section.contains_key("assumed_role_id"));
assert!(section.contains_key("expiration"));
assert!(section.contains_key("aws_access_key_id"));
assert!(section.contains_key("aws_secret_access_key"));
assert!(section.contains_key("aws_session_token"));
assert!(section.contains_key(ShortTermProfile::ASSUMED_ROLE_ID));
assert!(section.contains_key(ShortTermProfile::EXPIRATION));
assert!(section.contains_key(ShortTermProfile::ACCESS_KEY));
assert!(section.contains_key(ShortTermProfile::SECRET_KEY));
assert!(section.contains_key(ShortTermProfile::SESSION_TOKEN));
}

#[test]
Expand All @@ -316,10 +316,10 @@ mod test_short_term_profile {
handler.set_short_term_profile(&profile, profile_name);
let section = handler.ini.section(Some(profile_name)).unwrap();
assert!(!section.contains_key(ShortTermProfile::ASSUMED_ROLE_ARN));
assert!(!section.contains_key("assumed_role_id"));
assert!(section.contains_key("expiration"));
assert!(section.contains_key("aws_access_key_id"));
assert!(section.contains_key("aws_secret_access_key"));
assert!(section.contains_key("aws_session_token"));
assert!(!section.contains_key(ShortTermProfile::ASSUMED_ROLE_ID));
assert!(section.contains_key(ShortTermProfile::EXPIRATION));
assert!(section.contains_key(ShortTermProfile::ACCESS_KEY));
assert!(section.contains_key(ShortTermProfile::SECRET_KEY));
assert!(section.contains_key(ShortTermProfile::SESSION_TOKEN));
}
}
2 changes: 1 addition & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use cmds::{Command, SubCommand};
extern crate log;

async fn run() -> anyhow::Result<()> {
let (command, config) = cli::parse()?;
let (command, config) = cli::parse();
match command {
SubCommand::AssumeRole(cmd) => cmd.exec(&config).await?,
SubCommand::GetSessionToken(cmd) => cmd.exec(&config).await?,
Expand Down

0 comments on commit 13da28e

Please sign in to comment.