Skip to content

Commit

Permalink
Do not use print, as things should always be displayed.
Browse files Browse the repository at this point in the history
  • Loading branch information
fnando committed Aug 29, 2024
1 parent 67ba246 commit 4c5ff99
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 10 deletions.
2 changes: 1 addition & 1 deletion cmd/soroban-cli/src/commands/contract/alias.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ impl Cmd {
Cmd::Remove(remove) => remove.run(global_args)?,
Cmd::Add(add) => add.run(global_args)?,
Cmd::Show(show) => show.run(global_args)?,
Cmd::List(list) => list.run(global_args)?,
Cmd::List(list) => list.run()?,
}
Ok(())
}
Expand Down
14 changes: 5 additions & 9 deletions cmd/soroban-cli/src/commands/contract/alias/list.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,8 @@ use std::{fs, process};

use clap::{command, Parser};

use crate::commands::{config::network, global};
use crate::commands::config::network;
use crate::config::{alias, locator};
use crate::print::Print;

#[derive(Parser, Debug, Clone)]
#[group(skip)]
Expand Down Expand Up @@ -40,8 +39,7 @@ struct AliasEntry {
}

impl Cmd {
pub fn run(&self, global_args: &global::Args) -> Result<(), Error> {
let print = Print::new(global_args.quiet);
pub fn run(&self) -> Result<(), Error> {
let config_dir = self.config_locator.config_dir()?;
let pattern = config_dir
.join("contract-ids")
Expand Down Expand Up @@ -82,9 +80,7 @@ impl Cmd {

for network_passphrase in map.keys() {
if let Some(list) = map.clone().get_mut(network_passphrase) {
print.infoln(format!(
"Aliases available for network '{network_passphrase}'"
));
println!("ℹ️ Aliases available for network '{network_passphrase}'");

list.sort_by(|a, b| a.alias.cmp(&b.alias));

Expand All @@ -93,12 +89,12 @@ impl Cmd {
println!("{}: {}", entry.alias, entry.contract);
}

print.println("");
println!();
}
}

if !found {
print.warnln("No aliases defined for network");
eprintln!("⚠️ No aliases defined for network");

process::exit(1);
}
Expand Down

0 comments on commit 4c5ff99

Please sign in to comment.