diff options
| author | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-10 08:40:13 +0400 |
|---|---|---|
| committer | Ivan Molodetskikh <yalterz@gmail.com> | 2024-02-10 08:40:13 +0400 |
| commit | e68641c0a773c4c79591545cfabb549c69ece45d (patch) | |
| tree | 518e519584834b0ea8e1b429b9b1c2a2d0d1f93a /src/cli.rs | |
| parent | 2a892ef5116999d17c7e87e4f915219d45bf1219 (diff) | |
| download | niri-e68641c0a773c4c79591545cfabb549c69ece45d.tar.gz niri-e68641c0a773c4c79591545cfabb549c69ece45d.tar.bz2 niri-e68641c0a773c4c79591545cfabb549c69ece45d.zip | |
Move CLI types to submodule
Diffstat (limited to 'src/cli.rs')
| -rw-r--r-- | src/cli.rs | 49 |
1 files changed, 49 insertions, 0 deletions
diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 00000000..8dd8927d --- /dev/null +++ b/src/cli.rs @@ -0,0 +1,49 @@ +use std::ffi::OsString; +use std::path::PathBuf; + +use clap::{Parser, Subcommand}; + +use crate::utils::version; + +#[derive(Parser)] +#[command(author, version = version(), about, long_about = None)] +#[command(args_conflicts_with_subcommands = true)] +#[command(subcommand_value_name = "SUBCOMMAND")] +#[command(subcommand_help_heading = "Subcommands")] +pub struct Cli { + /// Path to config file (default: `$XDG_CONFIG_HOME/niri/config.kdl`). + #[arg(short, long)] + pub config: Option<PathBuf>, + /// Command to run upon compositor startup. + #[arg(last = true)] + pub command: Vec<OsString>, + + #[command(subcommand)] + pub subcommand: Option<Sub>, +} + +#[derive(Subcommand)] +pub enum Sub { + /// Validate the config file. + Validate { + /// Path to config file (default: `$XDG_CONFIG_HOME/niri/config.kdl`). + #[arg(short, long)] + config: Option<PathBuf>, + }, + /// Communicate with the running niri instance. + Msg { + #[command(subcommand)] + msg: Msg, + /// Format output as JSON. + #[arg(short, long)] + json: bool, + }, + /// Cause a panic to check if the backtraces are good. + Panic, +} + +#[derive(Subcommand)] +pub enum Msg { + /// List connected outputs. + Outputs, +} |
