Skip to content

Commit

Permalink
Rename container_name arg to name
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman committed Jul 16, 2024
1 parent d6d495f commit f42a9f9
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/network/container/logs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ pub struct Cmd {
pub container_args: Args,

/// Network container to tail (used in container name generation)
#[arg(required_unless_present = "container_name")]
#[arg(required_unless_present = "name")]
pub network: Option<Network>,
}

Expand Down
10 changes: 5 additions & 5 deletions cmd/soroban-cli/src/commands/network/container/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ pub enum Error {
#[derive(Debug, clap::Parser, Clone)]
pub struct Args {
/// Optional argument to specify the container name
#[arg(short = 'c', long, required_unless_present = "network")]
pub container_name: Option<String>,
#[arg(long, required_unless_present = "network")]
pub name: Option<String>,

/// Optional argument to override the default docker host. This is useful when you are using a non-standard docker host path for your Docker-compatible container runtime, e.g. Docker Desktop defaults to $HOME/.docker/run/docker.sock instead of /var/run/docker.sock
#[arg(short = 'd', long, help = DOCKER_HOST_HELP, env = "DOCKER_HOST")]
Expand All @@ -51,7 +51,7 @@ impl Args {
}

pub(crate) fn get_container_name(&self, network: Option<Network>) -> String {
self.container_name.as_ref().map_or_else(
self.name.as_ref().map_or_else(
|| {
format!(
"stellar-{}",
Expand All @@ -67,13 +67,13 @@ impl Args {
// (and we generate the container name) or the container name directly. Which is why we need to check if the
// container_name is present or not here.
pub(crate) fn get_container_name_arg(&self, network: Option<Network>) -> String {
self.container_name.as_ref().map_or_else(
self.name.as_ref().map_or_else(
|| {
network
.expect("Container name and/or network are required.")
.to_string()
},
|container_name| format!("--container-name {container_name}"),
|container_name| format!("--name {container_name}"),
)
}
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/network/container/stop.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub struct Cmd {
pub container_args: Args,

/// Network to stop (used in container name generation)
#[arg(required_unless_present = "container_name")]
#[arg(required_unless_present = "name")]
pub network: Option<Network>,
}

Expand Down

0 comments on commit f42a9f9

Please sign in to comment.