diff options
Diffstat (limited to '')
-rw-r--r-- | sys/nixpkgs/pkgs/lf-make-map/src/cli.rs | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/sys/nixpkgs/pkgs/lf-make-map/src/cli.rs b/sys/nixpkgs/pkgs/lf-make-map/src/cli.rs index 7650b39b..a398e451 100644 --- a/sys/nixpkgs/pkgs/lf-make-map/src/cli.rs +++ b/sys/nixpkgs/pkgs/lf-make-map/src/cli.rs @@ -1,6 +1,6 @@ use std::path::PathBuf; -use clap::{ArgAction, Parser}; +use clap::{ArgAction, Parser, Subcommand}; /// An automatic lf cd mapping generator #[derive(Parser, Debug)] @@ -11,9 +11,6 @@ pub struct Args { #[arg(long, short = 'n', env = "HOME")] pub home_name: PathBuf, - /// The directories to generate mappings for - pub relevant_directories: Vec<PathBuf>, - /// The number of directories to generate mappings for, starting from each `relevant_directory` #[arg(long, short, default_value = "2")] pub depth: usize, @@ -25,4 +22,28 @@ pub struct Args { /// Silence all output #[arg(long, short = 'q')] pub quiet: bool, + + #[command(subcommand)] + pub command: Command, +} + +#[derive(Subcommand, Debug)] +pub enum Command { + /// Visualize the generated mappings in a tree + Visualize { + #[command(flatten)] + options: CommandOptions, + }, + + /// Output the generated mappings in a format suitable for the lf config file + Generate { + #[command(flatten)] + options: CommandOptions, + }, +} + +#[derive(Debug, Parser)] +pub struct CommandOptions { + /// The directories to generate mappings for + pub relevant_directories: Vec<PathBuf>, } |