From 6fdf002608f93ee056c19c2f6fc7d1d343e236d2 Mon Sep 17 00:00:00 2001 From: Andrey Golovizin Date: Tue, 29 Jun 2021 23:05:11 +0200 Subject: [PATCH] Rename commands --- src/main.rs | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index e0ab877..d76eb78 100644 --- a/src/main.rs +++ b/src/main.rs @@ -16,13 +16,13 @@ struct Opts { } #[derive(Clap, Debug)] -struct ListOpts { +struct EndpointsOpts { #[clap(short, long)] json: bool, } #[derive(Clap, Debug)] -struct GetConfigOpts { +struct ConfigOpts { location: String, username: String, token: String, @@ -30,8 +30,8 @@ struct GetConfigOpts { #[derive(Clap, Debug)] enum Command { - List(ListOpts), - GetConfig(GetConfigOpts), + Endpoints(EndpointsOpts), + Config(ConfigOpts), } #[derive(Serialize, Deserialize, Debug)] @@ -77,13 +77,13 @@ fn main() -> Result<(), anyhow::Error> { env_logger::init(); let opts = Opts::parse(); match &opts.command { - Command::List(list_opts) => list(&list_opts)?, - Command::GetConfig(get_config_opts) => get_config(&get_config_opts)?, + Command::Endpoints(list_opts) => list(&list_opts)?, + Command::Config(get_config_opts) => get_config(&get_config_opts)?, } Ok(()) } -fn list(opts: &ListOpts) -> Result<(), anyhow::Error> { +fn list(opts: &EndpointsOpts) -> Result<(), anyhow::Error> { let locations: Locations = get_locations()?; if opts.json { println!("{}", serde_json::to_string(&locations)?); @@ -108,7 +108,7 @@ fn get_locations() -> Result { Ok(locations) } -fn get_config(opts: &GetConfigOpts) -> Result<(), anyhow::Error> { +fn get_config(opts: &ConfigOpts) -> Result<(), anyhow::Error> { let locations = get_locations()?; let location = locations .locations