//! The verbs `didbot` knows by name. use didbot_cli::FirstPartyVerb; /// Every first-party verb, and the binary that answers it. /// /// `didbot-operator` takes the verb as its own subcommand; `didbot-oauth` /// and `didbot-register` are one verb each, so the verb is dropped and the /// rest is passed as typed. pub const FIRST_PARTY: &[FirstPartyVerb] = &[ FirstPartyVerb { verb: "operate", binary: "didbot-operator", package: "didbot-operator", argv: &["operate"], about: "claim a server, admit an account beneath you, or check either", }, FirstPartyVerb { verb: "login", binary: "didbot-operator", package: "didbot-operator", argv: &["login"], about: "sign in as a deployment's operator", }, FirstPartyVerb { verb: "estop", binary: "didbot-operator", package: "didbot-operator", argv: &["estop"], about: "read or set a deployment's emergency stop", }, FirstPartyVerb { verb: "account", binary: "didbot-operator", package: "didbot-operator", argv: &["account"], about: "act on one account: lock, unlock, lift-quarantine, erase, delete, revoke-tokens", }, FirstPartyVerb { verb: "app", binary: "didbot-operator", package: "didbot-operator", argv: &["app"], about: "act on one OAuth application: end-logins", }, FirstPartyVerb { verb: "announce", binary: "didbot-operator", package: "didbot-operator", argv: &["announce"], about: "ask the relay to crawl a deployment", }, FirstPartyVerb { verb: "oauth", binary: "didbot-oauth", package: "didbot-agentd", argv: &[], about: "answer sign-ins as an agent: pending, show, approve, decline", }, FirstPartyVerb { verb: "register", binary: "didbot-register", package: "didbot-agentd", argv: &[], about: "make this machine an account, with a key that never leaves it", }, ]; /// The verb table as `--help` shows it. pub fn help_table() -> String { let width = FIRST_PARTY .iter() .map(|row| row.verb.len()) .max() .unwrap_or(0); let mut out = String::from("Verbs:\n"); for row in FIRST_PARTY { out.push_str(&format!( " {: didbot- from PATH, with the rest of the command line\n\ \n\ `didbot help ` is `didbot --help`.", ); out }