1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
//! Arguments for `shep host`: the list of machines whose shepherds this CLI
//! reaches, kept in `shep.toml`.
/// Arguments to `shep host`.
#[derive(Debug, clap::Args)]
pub struct HostArgs {
/// What to do to the list.
#[command(subcommand)]
pub command: HostCommand,
}
/// `shep host`'s subcommands.
#[derive(Debug, clap::Subcommand)]
pub enum HostCommand {
/// Add a machine to the list
///
/// A destination is what you would hand to `ssh`: a host name or an
/// `~/.ssh/config` alias, optionally with a `user@` in front. Letters,
/// digits, `.`, `_` and `-` only, and neither part may start with `-`.
/// Ports, jump hosts and IPv6 literals go in `~/.ssh/config`, where
/// `Port` and `ProxyJump` already apply.
///
/// The remote `shep` must be on the PATH that a non-interactive ssh
/// session sees. Adding a host that is already listed changes nothing to
/// the list.
///
/// `add` dials the host once, whether or not it was already listed,
/// without prompts and giving up after 5 seconds, and warns on stderr if
/// no shepherd answers. The entry stays and the exit is 0 either way.
Add {
/// The ssh destination, such as `amp2` or `deploy@build.example.com`
destination: String,
},
/// Remove a machine from the list
///
/// The destination is compared as written. Exits 3 when it is not listed.
Remove {
/// The ssh destination, exactly as listed
destination: String,
},
/// List the machines, in the order `shep.toml` holds them
///
/// Reads `shep.toml` only and never connects to a machine.
List,
}