Skip to main content

kinetic/
cli.rs

1//! Command-line interface definitions for Kinetic.
2
3use clap::{Parser, Subcommand};
4use std::path::PathBuf;
5
6/// Kinetic: High-performance, realtime analytics pipeline.
7#[derive(Parser, Debug)]
8#[command(author, version, about, long_about = None)]
9pub struct Cli {
10    /// Directory for persistent data (state, disk buffers, etc.)
11    #[arg(
12        short,
13        long,
14        env = "KINETIC_DATA_DIR",
15        default_value = "/var/lib/kinetic"
16    )]
17    pub data_dir: PathBuf,
18
19    #[command(subcommand)]
20    pub command: Commands,
21}
22
23#[derive(Subcommand, Debug)]
24pub enum Commands {
25    /// Start the Kinetic service
26    Run {
27        /// Path to the configuration file (YAML or JSON)
28        #[arg(short, long, default_value = "kinetic.yaml")]
29        config: PathBuf,
30    },
31
32    /// Validate a configuration file without starting the service
33    Validate {
34        /// Path to the configuration file to validate
35        #[arg(short, long)]
36        config: PathBuf,
37    },
38
39    /// Run in fleet mode, polling Nexus for configuration
40    Fleet {
41        /// Nexus API URL
42        #[arg(short, long, env = "NEXUS_URL")]
43        nexus_url: String,
44
45        /// Enrollment token (for bootstrap or manual enrollment)
46        #[arg(short, long, env = "ENROLLMENT_TOKEN")]
47        token: Option<String>,
48
49        /// Base poll interval in seconds
50        #[arg(short, long, default_value_t = 30)]
51        poll_interval: u64,
52    },
53
54    /// Run a CPU profile and output a flamegraph
55    Profile {
56        /// Duration of the profile in seconds
57        #[arg(short, long, default_value_t = 30)]
58        duration: u64,
59
60        /// Output file path for the flamegraph (SVG)
61        #[arg(short, long, default_value = "flamegraph.svg")]
62        output: PathBuf,
63    },
64}