diff options
author | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-09 13:20:13 +0200 |
---|---|---|
committer | Benedikt Peetz <benedikt.peetz@b-peetz.de> | 2024-05-09 13:20:13 +0200 |
commit | 16c7608bcfb876866abd62b65276951ee2a81b54 (patch) | |
tree | 8cf0cbb52c8212747e0c3a90df0ffb844fb91f7e /sys/nixpkgs/pkgs/lf-make-map/src/cli.rs | |
parent | feat(pkgs/lf-make-map): Support depths > 2 (diff) | |
download | nixos-config-16c7608bcfb876866abd62b65276951ee2a81b54.zip |
feat(pkgs/lf-make-map): Add de-serialization to lf mappings
Diffstat (limited to 'sys/nixpkgs/pkgs/lf-make-map/src/cli.rs')
-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>, } |