Skip to content

Commit

Permalink
Fix command line arguments conflicts
Browse files Browse the repository at this point in the history
* Remove `-t` short flag for tags
* Rename `-h` short flag to `-r` for `--https-redirect` flag
* Rename `-c` short flag to `-k` for `--clusters` flag

Signed-off-by: Florentin Dubois <florentin.dubois@clever-cloud.com>
  • Loading branch information
FlorentinDUBOIS committed Aug 4, 2022
1 parent 74faf6e commit 53a47ae
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 14 deletions.
12 changes: 4 additions & 8 deletions bin/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -267,7 +267,7 @@ pub enum ApplicationCmd {
id: String,
#[clap(short = 's', long = "sticky-session")]
sticky_session: bool,
#[clap(short = 'h', long = "https-redirect")]
#[clap(short = 'r', long = "https-redirect")]
https_redirect: bool,
#[clap(
long = "send-proxy",
Expand Down Expand Up @@ -397,7 +397,7 @@ pub enum HttpFrontendCmd {
path_begin: Option<String>,
#[clap(short = 'm', long = "method", help = "HTTP method")]
method: Option<String>,
#[clap(short = 't', long = "tag", help = "custom tags", parse(try_from_str = parse_tags))]
#[clap(long = "tags", help = "Specify tag (key-value pair) to apply on front-end (example: 'key=value, other-key=other-value')", parse(try_from_str = parse_tags))]
tags: Option<BTreeMap<String, String>>,
},
#[clap(name = "remove")]
Expand All @@ -416,8 +416,6 @@ pub enum HttpFrontendCmd {
path_begin: Option<String>,
#[clap(short = 'm', long = "method", help = "HTTP method")]
method: Option<String>,
#[clap(short = 't', long = "tag", help = "custom tags", parse(try_from_str = parse_tags))]
tags: Option<BTreeMap<String, String>>,
},
}

Expand All @@ -433,7 +431,7 @@ pub enum TcpFrontendCmd {
help = "frontend address, format: IP:port"
)]
address: SocketAddr,
#[clap(short = 't', long = "tag", help = "custom tags", parse(try_from_str = parse_tags))]
#[clap(long = "tags", help = "Specify tag (key-value pair) to apply on front-end (example: 'key=value, other-key=other-value')", parse(try_from_str = parse_tags))]
tags: Option<BTreeMap<String, String>>,
},
#[clap(name = "remove")]
Expand All @@ -446,8 +444,6 @@ pub enum TcpFrontendCmd {
help = "frontend address, format: IP:port"
)]
address: SocketAddr,
#[clap(short = 't', long = "tag", help = "custom tags", parse(try_from_str = parse_tags))]
tags: Option<BTreeMap<String, String>>,
},
}

Expand Down Expand Up @@ -748,7 +744,7 @@ pub enum QueryCmd {
)]
names: Vec<String>,
#[clap(
short = 'c',
short = 'k',
long = "clusters",
help = "list of cluster ids",
use_delimiter = true
Expand Down
10 changes: 4 additions & 6 deletions bin/src/ctl/request_builder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,11 +91,11 @@ impl CommandManager {
tags,
}))
}
TcpFrontendCmd::Remove { id, address, tags } => {
TcpFrontendCmd::Remove { id, address } => {
self.order_command(ProxyRequestData::RemoveTcpFrontend(TcpFrontend {
cluster_id: id,
address,
tags,
tags: None,
}))
}
}
Expand Down Expand Up @@ -126,15 +126,14 @@ impl CommandManager {
address,
method,
route,
tags,
} => self.order_command(ProxyRequestData::RemoveHttpFrontend(HttpFrontend {
route: route.into(),
address,
hostname,
path: PathRule::Prefix(path_begin.unwrap_or_else(|| "".to_string())),
method: method.map(String::from),
position: RulePosition::Tree,
tags,
tags: None,
})),
}
}
Expand Down Expand Up @@ -163,15 +162,14 @@ impl CommandManager {
address,
method,
route,
tags,
} => self.order_command(ProxyRequestData::RemoveHttpsFrontend(HttpFrontend {
route: route.into(),
address,
hostname,
path: PathRule::Prefix(path_begin.unwrap_or_else(|| "".to_string())),
method: method.map(String::from),
position: RulePosition::Tree,
tags,
tags: None,
})),
}
}
Expand Down

0 comments on commit 53a47ae

Please sign in to comment.