Skip to main content

nexus_cli/
cli.rs

1//! CLI argument parsing for the OpenNexus binary.
2
3use clap::{Parser, Subcommand, ValueEnum};
4
5#[derive(Debug, Parser)]
6#[command(name = "opennexus")]
7#[command(author, version, about, long_about = None)]
8#[command(propagate_version = true)]
9pub struct Cli {
10    /// Subcommand to execute.
11    #[command(subcommand)]
12    pub command: Option<Commands>,
13
14    /// Output format.
15    #[arg(long, global = true, default_value = "text")]
16    pub format: OutputFormat,
17}
18
19impl Cli {
20    pub fn parse_args() -> Self {
21        Self::parse()
22    }
23}
24
25#[derive(Debug, Clone, Copy, Default, PartialEq, Eq, ValueEnum)]
26pub enum OutputFormat {
27    #[default]
28    Text,
29    Json,
30}
31
32#[derive(Debug, Clone, Subcommand)]
33pub enum Commands {
34    /// Set up Nexus in the current project (extracts .nexus directory).
35    Setup,
36
37    /// Update Nexus to the latest published version via cargo.
38    Update,
39
40    /// Uninstall Nexus via cargo.
41    Uninstall,
42}