Radish alpha
r
rad:zwTxygwuz5LDGBq255RA2CbNGrz8
Radicle CI broker
Radicle
Git
doc: add help texts to cib options and subcommands
Merged liw opened 1 year ago

Signed-off-by: Lars Wirzenius liw@liw.fi

1 file changed +34 -0 f0a3e65c ac3fcf28
modified src/bin/cib.rs
@@ -49,12 +49,21 @@ fn fallible_main() -> Result<(), CibError> {
    Ok(())
}

+
/// The Radicle CI broker.
+
///
+
/// Listen to events from the local Radicle node, filter them, and run
+
/// CI for the events that get past the filter. The filter, and the
+
/// way CI is run, is defined in the configuration file.
#[derive(Debug, Parser)]
#[command(version)]
struct Args {
+
    /// Load configuration from this YAML file. (There is no default
+
    /// location.)
    #[clap(long)]
    config: PathBuf,

+
    /// Se the global log level. Log messages that on at least this
+
    /// level get written to the standard error output.
    #[clap(long, value_enum)]
    log_level: Option<logger::LogLevel>,

@@ -90,6 +99,11 @@ impl Args {

#[derive(Debug, Parser)]
enum Cmd {
+
    /// Show the configuration, as derived from the configuration file
+
    /// and built-in defaults.
+
    ///
+
    /// The configuration file location is specified with the
+
    /// `--config` option.
    Config(ConfigCmd),
    Insert(InsertCmd),
    Queued(QueuedCmd),
@@ -98,6 +112,10 @@ enum Cmd {

#[derive(Debug, Parser)]
struct ConfigCmd {
+
    /// Write output to this file. The default is to write to the
+
    /// standard output. This option is an alternative to redirecting
+
    /// output using shell constructs, for situations when that is not
+
    /// an option.
    #[clap(long)]
    output: Option<PathBuf>,
}
@@ -118,6 +136,11 @@ impl ConfigCmd {
    }
}

+
/// Read events from the local node and insert them into the event
+
/// queue in the database.
+
///
+
/// Do not run CI based on the events. End when the connection to the
+
/// node is terminated by the node shutting down.
#[derive(Debug, Parser)]
struct InsertCmd {}

@@ -139,6 +162,10 @@ impl InsertCmd {
    }
}

+
/// Process events from the queue in the database.
+
///
+
/// Do not read further events from the local node. End when the queue
+
/// is empty, or when a shutdown event is encountered in the queue.
#[derive(Debug, Parser)]
struct QueuedCmd {}

@@ -203,6 +230,13 @@ impl QueuedCmd {
    }
}

+
/// Read events from the local node,insert them into the event queue
+
/// in the database, then process events in the queue by running CI
+
/// based on each each event.
+
///
+
/// This is the subcommand to run CI normally.
+
///
+
/// This is combination of the subcommands `insert` and `queued`.
#[derive(Debug, Parser)]
struct ProcessEventsCmd {}