91 lines
2.2 KiB
Rust
91 lines
2.2 KiB
Rust
use clap::{Parser, Subcommand};
|
|
|
|
#[derive(Parser)]
|
|
#[command(
|
|
name = "p",
|
|
about = "Push jobs to remote worker machines",
|
|
long_about = "\
|
|
Push jobs to remote worker machines with directory sync and attach/detach support.
|
|
|
|
Run a command on the default worker:
|
|
p -- <command>
|
|
|
|
Run on a specific worker:
|
|
p <worker> -- <command>
|
|
|
|
Skip directory sync:
|
|
p -n -- <command>"
|
|
)]
|
|
pub struct Cli {
|
|
#[command(subcommand)]
|
|
pub command: Command,
|
|
}
|
|
|
|
#[derive(Subcommand)]
|
|
pub enum Command {
|
|
/// List all jobs across all workers
|
|
Ls,
|
|
|
|
/// Re-attach to the console of a running job
|
|
Attach {
|
|
/// Job ID or unambiguous prefix
|
|
job_id: String,
|
|
},
|
|
|
|
/// Print captured output of a job (running or finished)
|
|
Logs {
|
|
/// Job ID or unambiguous prefix
|
|
job_id: String,
|
|
/// Follow output in real time (running jobs only)
|
|
#[arg(short, long)]
|
|
follow: bool,
|
|
},
|
|
|
|
/// Kill a running job
|
|
Stop {
|
|
/// Job ID or unambiguous prefix
|
|
job_id: String,
|
|
},
|
|
|
|
/// Copy a file or directory from a job's work directory back to the client
|
|
Pull {
|
|
/// Job ID or unambiguous prefix
|
|
job_id: String,
|
|
/// Path relative to the job's work directory on the worker
|
|
remote_path: String,
|
|
/// Local destination (defaults to current directory)
|
|
local_dest: Option<String>,
|
|
},
|
|
|
|
/// Remove a job record and its remote work directory
|
|
Rm {
|
|
/// Job ID or unambiguous prefix
|
|
job_id: String,
|
|
/// Force removal even if the job is still running
|
|
#[arg(short, long)]
|
|
force: bool,
|
|
},
|
|
|
|
/// Register a remote worker
|
|
Register {
|
|
/// SSH connection string: user@host, user@host:port, or an SSH config alias
|
|
connection: String,
|
|
/// Worker name (defaults to the hostname part of the connection string)
|
|
#[arg(short, long)]
|
|
name: Option<String>,
|
|
},
|
|
|
|
/// List registered workers
|
|
Workers {
|
|
/// Check reachability of each worker over SSH
|
|
#[arg(short, long)]
|
|
check: bool,
|
|
},
|
|
|
|
/// Set the default worker
|
|
Default {
|
|
/// Worker name
|
|
worker: String,
|
|
},
|
|
}
|