Skip to content

Commit

Permalink
Merge pull request #519 from dora-rs/cli-help
Browse files Browse the repository at this point in the history
Provide help messages for CLI
  • Loading branch information
haixuanTao authored May 30, 2024
2 parents f50478b + d037303 commit 7a940b8
Showing 1 changed file with 37 additions and 6 deletions.
43 changes: 37 additions & 6 deletions binaries/cli/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -43,21 +43,30 @@ struct Args {
enum Command {
/// Check if the coordinator and the daemon is running.
Check {
#[clap(long)]
/// Path to the dataflow descriptor file (enables additional checks)
#[clap(long, value_name = "PATH", value_hint = clap::ValueHint::FilePath)]
dataflow: Option<PathBuf>,
#[clap(long)]
coordinator_addr: Option<IpAddr>,
},
/// Generate a visualization of the given graph using mermaid.js. Use --open to open browser.
Graph {
/// Path to the dataflow descriptor file
#[clap(value_name = "PATH", value_hint = clap::ValueHint::FilePath)]
dataflow: PathBuf,
/// Visualize the dataflow as a Mermaid diagram (instead of HTML)
#[clap(long, action)]
mermaid: bool,
/// Open the HTML visualization in the browser
#[clap(long, action)]
open: bool,
},
/// Run build commands provided in the given dataflow.
Build { dataflow: PathBuf },
Build {
/// Path to the dataflow descriptor file
#[clap(value_name = "PATH", value_hint = clap::ValueHint::FilePath)]
dataflow: PathBuf,
},
/// Generate a new project, node or operator. Choose the language between Rust, Python, C or C++.
New {
#[clap(flatten)]
Expand All @@ -67,36 +76,48 @@ enum Command {
},
/// Spawn a coordinator and a daemon.
Up {
#[clap(long)]
/// Use a custom configuration
#[clap(long, hide = true, value_name = "PATH", value_hint = clap::ValueHint::FilePath)]
config: Option<PathBuf>,
// TODO
#[clap(long)]
coordinator_addr: Option<IpAddr>,
},
/// Destroy running coordinator and daemon. If some dataflows are still running, they will be stopped first.
Destroy {
#[clap(long)]
/// Use a custom configuration
#[clap(long, hide = true)]
config: Option<PathBuf>,
// TODO
#[clap(long)]
coordinator_addr: Option<IpAddr>,
},
/// Start the given dataflow path. Attach a name to the running dataflow by using --name.
Start {
/// Path to the dataflow descriptor file
#[clap(value_name = "PATH", value_hint = clap::ValueHint::FilePath)]
dataflow: PathBuf,
/// Assign a name to the dataflow
#[clap(long)]
name: Option<String>,
#[clap(long)]
coordinator_addr: Option<IpAddr>,
/// Attach to the dataflow and wait for its completion
#[clap(long, action)]
attach: bool,
/// Enable hot reloading (Python only)
#[clap(long, action)]
hot_reload: bool,
},
/// Stop the given dataflow UUID. If no id is provided, you will be able to choose between the running dataflows.
Stop {
/// UUID of the dataflow that should be stopped
uuid: Option<Uuid>,
/// Name of the dataflow that should be stopped
#[clap(long)]
name: Option<String>,
#[clap(long)]
/// Kill the dataflow if it doesn't stop after the given duration
#[clap(long, value_name = "DURATION")]
#[arg(value_parser = parse)]
grace_duration: Option<Duration>,
#[clap(long)]
Expand All @@ -112,7 +133,11 @@ enum Command {
/// Show logs of a given dataflow and node.
#[command(allow_missing_positional = true)]
Logs {
/// Identifier of the dataflow
#[clap(value_name = "UUID_OR_NAME")]
dataflow: Option<String>,
/// Show logs for the given node
#[clap(value_name = "NAME")]
node: String,
#[clap(long)]
coordinator_addr: Option<IpAddr>,
Expand All @@ -123,6 +148,7 @@ enum Command {
// Upgrade,
/// Run daemon
Daemon {
/// Unique identifier for the machine (required for distributed dataflows)
#[clap(long)]
machine_id: Option<String>,
/// The IP address and port this daemon will bind to.
Expand All @@ -133,7 +159,7 @@ enum Command {
#[clap(long)]
coordinator_addr: Option<SocketAddr>,

#[clap(long)]
#[clap(long, hide = true)]
run_dataflow: Option<PathBuf>,
},
/// Run runtime
Expand All @@ -149,11 +175,16 @@ enum Command {

#[derive(Debug, clap::Args)]
pub struct CommandNew {
/// The entity that should be created
#[clap(long, value_enum, default_value_t = Kind::Dataflow)]
kind: Kind,
/// The programming language that should be used
#[clap(long, value_enum, default_value_t = Lang::Rust)]
lang: Lang,
/// Desired name of the entity
name: String,
/// Where to create the entity
#[clap(hide = true)]
path: Option<PathBuf>,
}

Expand Down

0 comments on commit 7a940b8

Please sign in to comment.