mission-control-contracts

    Shared Mission Control commands for the CLI, the web UI and the desktop shell

    mission-control
    contract
    cli
    Download zip
    Author
    Version
    0.3.0
    License
    Apache-2.0
    Last updated
    1 hour ago
    Downloads
    164

    #moonrockz/mission-control-contracts

    Shared commands for the Mission Control CLI, the Rabbita web UI and the Proton desktop shell.

    moon add moonrockz/mission-control-contracts

    version() gives the workspace version as a Version value (three integer parts; Version::Version(text) raises VersionError for any other text). Commands form a tree. help and version are single words. The other commands are a noun and a verb:

    PathValue
    kb validateKb(Validate)
    kb rules list, show, check, testKb(Rules(List)), ...
    kb profiles list, showKb(Profiles(List)), ...
    config showConfig(Show)

    Command::Command(path) reads a path such as kb validate, or an alias such as --version. Command::parse(args) reads the command at the start of the arguments and returns it with the arguments that follow it. Both raise CommandError::UnknownCommand with the words that were read (kb nope), or CommandError::MissingVerb with the Noun when the words stop after a noun (kb).

    Each command gives its path (path() and path_text()), its noun (noun()), its Proton command ID (proton_id(): the path joined with ., such as mission-control.version or mission-control.kb.validate) and its help line (description()). commands lists every command and nouns lists the top-level nouns, in help order. Noun::commands() lists the commands of one noun.

    CommandError

    pub(all) suberror CommandError {
    UnknownCommand(String)
    MissingVerb(Noun)
    } derive(Eq,
    Debug
    )

    Raised when a text names no command.

    CommandError::equal

    automatically derived

    CommandError::not_equal

    fn CommandError::not_equal(x : CommandError, y : CommandError) -> Bool
    automatically derived

    CommandError::to_repr

    automatically derived

    VersionError

    pub(all) suberror VersionError {
    InvalidVersion(String)
    } derive(Eq,
    Debug
    )

    Raised when a text is not a version.

    VersionError::equal

    automatically derived

    VersionError::not_equal

    fn VersionError::not_equal(x : VersionError, y : VersionError) -> Bool
    automatically derived

    VersionError::to_repr

    automatically derived

    Command

    pub(all) enum Command {
    Help
    Version
    Kb(KbCommand)
    Config(ConfigCommand)
    } derive(Eq,
    Debug
    )

    A command the CLI, the web UI and the desktop shell all understand. A command is a single word, such as version, or a noun and a verb, such as kb validate.

    Command::Command

    fn Command::Command(path : String) -> Command raise CommandError

    Reads a command path, such as kb validate or version. Words are separated by spaces. --help, -h, --version and -V are accepted.

    Command::description

    fn Command::description(self : Command) -> String

    One line that describes the command in the help text.

    Command::equal

    fn Command::equal(Command, Command) -> Bool
    automatically derived

    Command::not_equal

    fn Command::not_equal(x : Command, y : Command) -> Bool
    automatically derived

    Command::noun

    fn Command::noun(self : Command) -> Noun?

    The noun that the command belongs to. help and version have none.

    Command::parse

    fn Command::parse(args : ArrayView[String]) -> (Command, ArrayView[String]) raise CommandError

    Reads the command at the start of the arguments, and returns it with the arguments that follow it. No arguments is the help command.

    Command::path

    fn Command::path(self : Command) -> Array[String]

    The words of the command on the command line, such as ["kb", "validate"].

    Command::path_text

    fn Command::path_text(self : Command) -> String

    The command path as one text, such as kb validate.

    Command::proton_id

    fn Command::proton_id(self : Command) -> String

    The ID of the Proton command that the desktop shell exposes: the path joined with . after mission-control..

    Command::to_repr

    automatically derived

    ConfigCommand

    pub(all) enum ConfigCommand {
    Show
    } derive(Eq,
    Debug
    )

    A verb of the config noun.

    ConfigCommand::equal

    automatically derived

    ConfigCommand::not_equal

    fn ConfigCommand::not_equal(x : ConfigCommand, y : ConfigCommand) -> Bool
    automatically derived

    ConfigCommand::to_repr

    automatically derived

    KbCommand

    pub(all) enum KbCommand {
    Validate
    Rules(RulesCommand)
    Profiles(ProfilesCommand)
    } derive(Eq,
    Debug
    )

    A verb of the kb noun, which checks and inspects knowledge bundles.

    KbCommand::equal

    fn KbCommand::equal(KbCommand, KbCommand) -> Bool
    automatically derived

    KbCommand::not_equal

    fn KbCommand::not_equal(x : KbCommand, y : KbCommand) -> Bool
    automatically derived

    KbCommand::to_repr

    automatically derived

    Noun

    pub(all) enum Noun {
    Kb
    KbRules
    KbProfiles
    Config
    } derive(Eq,
    Debug
    )

    A noun that groups commands. The help text lists each noun once.

    Noun::commands

    fn Noun::commands(self : Noun) -> Array[Command]

    The commands whose path starts with the path of the noun, in help order.

    Noun::description

    fn Noun::description(self : Noun) -> String

    One line that describes the noun in the help text.

    Noun::equal

    fn Noun::equal(Noun, Noun) -> Bool
    automatically derived

    Noun::not_equal

    fn Noun::not_equal(x : Noun, y : Noun) -> Bool
    automatically derived

    Noun::path

    fn Noun::path(self : Noun) -> Array[String]

    The words of the noun on the command line, such as ["kb", "rules"].

    Noun::path_text

    fn Noun::path_text(self : Noun) -> String

    The noun path as one text, such as kb rules.

    Noun::to_repr

    automatically derived

    ProfilesCommand

    pub(all) enum ProfilesCommand {
    List
    Show
    } derive(Eq,
    Debug
    )

    A verb of kb profiles.

    ProfilesCommand::equal

    automatically derived

    ProfilesCommand::not_equal

    fn ProfilesCommand::not_equal(x : ProfilesCommand, y : ProfilesCommand) -> Bool
    automatically derived

    ProfilesCommand::to_repr

    automatically derived

    RulesCommand

    pub(all) enum RulesCommand {
    List
    Show
    Check
    Test
    } derive(Eq,
    Debug
    )

    A verb of kb rules.

    RulesCommand::equal

    automatically derived

    RulesCommand::not_equal

    fn RulesCommand::not_equal(x : RulesCommand, y : RulesCommand) -> Bool
    automatically derived

    RulesCommand::to_repr

    automatically derived

    Version

    A version such as 0.0.2: three non-negative integer parts.
    impl Show for Version

    Version::Version

    fn Version::Version(text : String) -> Version raise VersionError

    Parses X.Y.Z. Each part is a non-negative integer with at most nine digits and no leading zero.

    Version::compare

    fn Version::compare(Version, Version) -> Int
    automatically derived

    Version::current

    fn Version::current() -> Version

    The version of this module. It matches the workspace version.

    Version::equal

    fn Version::equal(Version, Version) -> Bool
    automatically derived

    Version::hash

    fn Version::hash(self : Version) -> Int
    automatically derived

    Version::hash_combine

    fn Version::hash_combine(Version, Hasher) -> Unit
    automatically derived

    Version::major

    fn Version::major(self : Version) -> Int

    Version::minor

    fn Version::minor(self : Version) -> Int

    Version::not_equal

    fn Version::not_equal(x : Version, y : Version) -> Bool
    automatically derived

    Version::op_ge

    fn Version::op_ge(x : Version, y : Version) -> Bool
    automatically derived

    Version::op_gt

    fn Version::op_gt(x : Version, y : Version) -> Bool
    automatically derived

    Version::op_le

    fn Version::op_le(x : Version, y : Version) -> Bool
    automatically derived

    Version::op_lt

    fn Version::op_lt(x : Version, y : Version) -> Bool
    automatically derived

    Version::output

    fn Version::output(self : Version, logger : &Logger) -> Unit

    Version::patch

    fn Version::patch(self : Version) -> Int

    Version::to_repr

    automatically derived

    Version::to_string

    fn Version::to_string(self : Version) -> String

    commands

    let commands : ReadOnlyArray[Command]

    Every command, in the order that the help text lists them.

    nouns

    let nouns : ReadOnlyArray[Noun]

    The nouns at the top of the command tree, in help order.

    version

    fn version() -> Version

    The version of this module. It matches the workspace version.

    Source Files