Skip to content

Commit 7a31e04

Browse files
committed
feat: add Backend.AI branding to help output and simplify no-arg usage
1 parent fdfa1d4 commit 7a31e04

2 files changed

Lines changed: 17 additions & 11 deletions

File tree

src/cli.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,10 @@ use std::path::PathBuf;
1919
#[command(
2020
name = "bssh",
2121
version,
22-
before_help = "",
22+
before_help = "\n\nBackend.AI SSH - Parallel command execution across cluster nodes",
2323
about = "Backend.AI SSH - SSH-compatible parallel command execution tool",
24-
long_about = "bssh is a high-performance SSH client with parallel execution capabilities.\nIt can be used as a drop-in replacement for SSH (single host) or as a powerful cluster management tool (multiple hosts).\n\nSSH Compatibility Mode:\n bssh user@host # Interactive shell\n bssh user@host command # Execute command\n bssh -p 2222 user@host # Custom port\n bssh -i key.pem user@host # Custom key\n\nMulti-Server Mode:\n bssh -C production \"uptime\" # Execute on cluster\n bssh -H \"host1,host2\" \"df -h\" # Execute on hosts\n\nThe tool provides secure file transfer using SFTP and supports SSH keys, SSH agent, and password authentication.\nIt automatically detects Backend.AI multi-node session environments.",
25-
after_help = "EXAMPLES:\n SSH Mode:\n bssh user@host # Interactive shell\n bssh admin@server.com \"uptime\" # Execute command\n bssh -p 2222 -i ~/.ssh/key user@host # Custom port and key\n\n Multi-Server Mode:\n bssh -C production \"systemctl status\" # Use cluster config\n bssh -H \"web1,web2,web3\" \"df -h\" # Direct hosts\n\n File Operations:\n bssh -C staging upload file.txt /tmp/ # Upload to cluster\n bssh -H host1,host2 download /etc/hosts ./backups/\n\n Other Commands:\n bssh list # List configured clusters\n bssh -C production ping # Test connectivity\n\nFor more information: https://github.com/lablup/bssh"
24+
long_about = "bssh is a high-performance SSH client with parallel execution capabilities.\nIt can be used as a drop-in replacement for SSH (single host) or as a powerful cluster management tool (multiple hosts).\n\nThe tool provides secure file transfer using SFTP and supports SSH keys, SSH agent, and password authentication.\nIt automatically detects Backend.AI multi-node session environments.",
25+
after_help = "EXAMPLES:\n SSH Mode:\n bssh user@host # Interactive shell\n bssh admin@server.com \"uptime\" # Execute command\n bssh -p 2222 -i ~/.ssh/key user@host # Custom port and key\n\n Multi-Server Mode:\n bssh -C production \"systemctl status\" # Use cluster config\n bssh -H \"web1,web2,web3\" \"df -h\" # Direct hosts\n\n File Operations:\n bssh -C staging upload file.txt /tmp/ # Upload to cluster\n bssh -H host1,host2 download /etc/hosts ./backups/\n\n Other Commands:\n bssh list # List configured clusters\n bssh -C production ping # Test connectivity\n\nDeveloped and maintained as part of the Backend.AI project.\nFor more information: https://github.com/lablup/bssh"
2626
)]
2727
pub struct Cli {
2828
/// SSH destination in format: [user@]hostname[:port] or ssh://[user@]hostname[:port]

src/main.rs

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
// limitations under the License.
1414

1515
use anyhow::Result;
16-
use clap::{CommandFactory, Parser};
16+
use clap::Parser;
1717
use std::path::{Path, PathBuf};
1818
use std::time::Duration;
1919

@@ -34,11 +34,17 @@ use bssh::{
3434
utils::init_logging,
3535
};
3636

37-
/// Show help message and exit
38-
fn show_help() {
39-
let mut cmd = Cli::command();
40-
let _ = cmd.print_help();
41-
eprintln!(); // Add a newline after help
37+
/// Show concise usage message (like SSH)
38+
fn show_usage() {
39+
println!("usage: bssh [-46AqtTvx] [-C cluster] [-F configfile] [-H hosts]");
40+
println!(" [-i identity_file] [-J destination] [-l login_name]");
41+
println!(" [-o option] [-p port] [--config config] [--parallel N]");
42+
println!(" [--output-dir dir] [--timeout seconds] [--use-agent]");
43+
println!(" destination [command [argument ...]]");
44+
println!(" bssh [-Q query_option]");
45+
println!(" bssh [exec|list|ping|upload|download|interactive] ...");
46+
println!();
47+
println!("For more information, try 'bssh --help'");
4248
}
4349

4450
/// Format a Duration into a human-readable string
@@ -72,8 +78,8 @@ async fn main() -> Result<()> {
7278
// Check if no arguments were provided
7379
let args: Vec<String> = std::env::args().collect();
7480
if args.len() == 1 {
75-
// Show help when no arguments provided
76-
show_help();
81+
// Show concise usage when no arguments provided (like SSH)
82+
show_usage();
7783
std::process::exit(0);
7884
}
7985

0 commit comments

Comments
 (0)