feat: add list servers command
This commit is contained in:
+16
@@ -31,6 +31,22 @@ fn run(cli: &cli::Cli) -> Result<()> {
|
||||
let path = config::resolve(cli.config.as_deref())?;
|
||||
let cfg = config::load(&path)?;
|
||||
|
||||
if cli.list_servers {
|
||||
println!("config: {}", path.display());
|
||||
println!("configured servers:");
|
||||
for (name, server) in &cfg.servers {
|
||||
let mut line = format!(" - {name} {}", server.host);
|
||||
if let Some(port) = server.port {
|
||||
line.push_str(&format!(":{port}"));
|
||||
}
|
||||
if let Some(user) = &server.user {
|
||||
line.push_str(&format!(" as {user}"));
|
||||
}
|
||||
println!("{line}");
|
||||
}
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
if cli.list {
|
||||
println!("config: {}", path.display());
|
||||
println!("configured projects:");
|
||||
|
||||
Reference in New Issue
Block a user