Rust · 1085 bytes Raw Blame History
1 use clap::Parser;
2
3 /// fussr - A git staging TUI tool
4 ///
5 /// Navigate and stage files with a tree view interface.
6 /// Rust port of fuss (written in Fortran).
7 #[derive(Parser, Debug)]
8 #[command(name = "fussr")]
9 #[command(author, version, about, long_about = None)]
10 pub struct Args {
11 /// Show all files, not just dirty ones
12 #[arg(short = 'a', long = "all")]
13 pub show_all: bool,
14
15 /// Show full file paths (alias for --all)
16 #[arg(short = 'f', long = "full")]
17 pub full: bool,
18
19 /// Print tree and exit (non-interactive mode)
20 #[arg(short = 'p', long = "print")]
21 pub print_only: bool,
22
23 /// Interactive mode (default behavior)
24 #[arg(short = 'i', long = "interactive")]
25 pub interactive: bool,
26 }
27
28 impl Args {
29 /// Parse command line arguments
30 pub fn parse_args() -> Self {
31 Self::parse()
32 }
33
34 /// Whether to show all files
35 pub fn show_all_files(&self) -> bool {
36 self.show_all || self.full
37 }
38
39 /// Whether to run in interactive mode
40 pub fn is_interactive(&self) -> bool {
41 !self.print_only
42 }
43 }
44