From fbe032b2365c7675631724973f548796854634aa Mon Sep 17 00:00:00 2001 From: Florian Paul Azim Hoberg Date: Tue, 6 Jan 2026 07:43:42 +0100 Subject: [PATCH] feature: Add list only mode to print out desired cpu type to stdout Fixes: #16 --- .changelogs/1.2.0/16-add-list-only-mode.yml | 2 ++ .changelogs/1.2.0/release_meta.yaml | 1 + ProxCLMC/src/main.rs | 10 ++++++++++ README.md | 13 +++++++------ 4 files changed, 20 insertions(+), 6 deletions(-) create mode 100644 .changelogs/1.2.0/16-add-list-only-mode.yml create mode 100644 .changelogs/1.2.0/release_meta.yaml diff --git a/.changelogs/1.2.0/16-add-list-only-mode.yml b/.changelogs/1.2.0/16-add-list-only-mode.yml new file mode 100644 index 0000000..3704c5e --- /dev/null +++ b/.changelogs/1.2.0/16-add-list-only-mode.yml @@ -0,0 +1,2 @@ +added: + - Add list only mode to print out desired cpu type to stdout (@gyptazy). [#16] diff --git a/.changelogs/1.2.0/release_meta.yaml b/.changelogs/1.2.0/release_meta.yaml new file mode 100644 index 0000000..9c46556 --- /dev/null +++ b/.changelogs/1.2.0/release_meta.yaml @@ -0,0 +1 @@ +date: 2026-01-06 diff --git a/ProxCLMC/src/main.rs b/ProxCLMC/src/main.rs index 4bda850..a6a4c97 100644 --- a/ProxCLMC/src/main.rs +++ b/ProxCLMC/src/main.rs @@ -38,6 +38,9 @@ struct Cli { #[arg(short, long = "ssh-file", default_value = "/root/.ssh/id_rsa")] ssh_file: PathBuf, + #[arg(long)] + list_only: bool, + #[arg(long)] version: bool, @@ -251,6 +254,13 @@ fn main() -> io::Result<()> { enrich_node_cpu_ssh(node, "root", &args.ssh_file); } + if args.list_only { + if let Some(cluster_cpu) = cluster_min_cpu_type(&nodes) { + println!("{}", cluster_cpu.as_str()); + } + return Ok(()); + } + println!("Detected nodes:"); for n in &nodes { println!("{} | {} | {}", n.name, n.ring0_addr, n.cpu_type); diff --git a/README.md b/README.md index bbb8371..b40da0d 100644 --- a/README.md +++ b/README.md @@ -86,12 +86,13 @@ proxclmc ### Options The following cli options are available: -| Short | Long | Argument | Default | Description | -|------:|-------------|--------------|--------------------------|--------------------| -| `-s` | `--ssh-file`| `` | `/root/.ssh/id_rsa` | SSH private key to use | -| | `--version` | | | Print version information | -| `-v` | `--verbose` | | | Enable verbose output | -| `-h` | `--help` | | | Print help | +| Short | Long | Argument | Default | Description | +|------:|---------------|--------------|--------------------------|--------------------| +| `-s` | `--ssh-file`. | `` | `/root/.ssh/id_rsa` | SSH private key to use | +| | `--version` | | | Print version information | +| `-l` | `--list-only` | | | Returns only the desired CPU type on stdout | +| `-v` | `--verbose` | | | Enable verbose output | +| `-h` | `--help` | | | Print help | ## Building from Source Building ProxCLMC is easy and can be done by installing the following requirements for Rust/Cargo: