Skip to content

Commit

Permalink
print out list only in case given by user
Browse files Browse the repository at this point in the history
List of the current keys should be printed only when the user specified
the option --list. If not, simply only sync.
  • Loading branch information
dongsupark committed Nov 15, 2023
1 parent e03d2cd commit 2584dbd
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ extern crate uzers;

extern crate update_ssh_keys;

use clap::parser::ValueSource;
use clap::{crate_version, Arg, Command};
use std::fs::File;
use std::path::PathBuf;
Expand Down Expand Up @@ -271,7 +272,11 @@ fn config() -> Result<Config> {
.map(|name| UssCommand::Disable { name: name.into() })
})
.unwrap_or(if matches.contains_id("list") {
UssCommand::List
if matches.value_source("list") == Some(ValueSource::CommandLine) {
UssCommand::List
} else {
UssCommand::Sync
}
} else {
UssCommand::Sync
});
Expand Down

0 comments on commit 2584dbd

Please sign in to comment.