cli.rs
1 //! Structure definitions for command line arguments. 2 use clap::{Parser, Subcommand}; 3 use std::path::PathBuf; 4 /// Manage user dotfiles. 5 #[derive(Parser)] 6 pub struct Args { 7 /// The path to the config file. 8 #[arg(short, long)] 9 pub config: Option<PathBuf>, 10 /// The username to use in place of $USER. 11 #[arg(short, long)] 12 pub username: Option<String>, 13 /// The sub command the program should run. 14 #[command(subcommand)] 15 pub command: Command, 16 } 17 #[derive(Subcommand)] 18 pub enum Command { 19 /// Add a path to the configuration. 20 Add { 21 /// The path to be added. 22 path: PathBuf 23 }, 24 /// Remove a path from the configuration. 25 Remove { 26 /// The path to be removed. 27 path: PathBuf 28 }, 29 /// Install a configuration from a zip archive. 30 Install { 31 /// The path of the archive. 32 path: PathBuf 33 }, 34 /// Export a configuration to a zip archive. 35 Export { 36 /// The path of the new archive 37 path: Option<PathBuf>, 38 /// Overwrite an existing archive. 39 #[arg(short, long, default_value_t = false)] 40 overwrite: bool 41 }, 42 }