Skip to content

Commit

Permalink
Refactor Name
Browse files Browse the repository at this point in the history
  • Loading branch information
elizabethengelman committed Jul 18, 2024
1 parent ec3d39f commit 996dea4
Show file tree
Hide file tree
Showing 4 changed files with 5 additions and 9 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 @@ -24,7 +24,7 @@ pub struct Cmd {

impl Cmd {
pub async fn run(&self) -> Result<(), Error> {
let container_name = Name::new(self.name.clone()).get_internal_container_name();
let container_name = Name(self.name.clone()).get_internal_container_name();
let docker = self.container_args.connect_to_docker().await?;
let logs_stream = &mut docker.logs(
&container_name,
Expand Down
8 changes: 2 additions & 6 deletions cmd/soroban-cli/src/commands/network/container/shared.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,12 +126,8 @@ impl fmt::Display for Network {
}
}

pub struct Name(String);
pub struct Name(pub String);
impl Name {
pub fn new(name: String) -> Self {
Self(name)
}

pub fn get_internal_container_name(&self) -> String {
format!("stellar-{}", self.0)
}
Expand Down Expand Up @@ -178,4 +174,4 @@ async fn check_docker_connection(docker: &Docker) -> Result<(), bollard::errors:
Err(err)
}
}
}
}
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/network/container/start.rs
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ impl Cmd {
}

fn container_name(&self) -> Name {
Name::new(self.name.clone().unwrap_or(self.network.to_string()))
Name(self.name.clone().unwrap_or(self.network.to_string()))
}

fn print_log_message(&self) {
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 @@ -29,7 +29,7 @@ pub struct Cmd {

impl Cmd {
pub async fn run(&self) -> Result<(), Error> {
let container_name = Name::new(self.name.clone());
let container_name = Name(self.name.clone());
let docker = self.container_args.connect_to_docker().await?;
println!(
"ℹ️ Stopping container: {}",
Expand Down

0 comments on commit 996dea4

Please sign in to comment.