1 use std::path::PathBuf;
3 use clap::{Parser, ValueHint};
5 // Ouch command line options (docstrings below are part of --help)
6 /// A command-line utility for easily compressing and decompressing files and directories.
8 /// Supported formats: tar, zip, bz/bz2, gz, lz4, xz/lz/lzma, zst.
10 /// Repository: https://github.com/ouch-org/ouch
11 #[derive(Parser, Debug)]
12 #[command(about, version)]
13 // Disable rustdoc::bare_urls because rustdoc parses URLs differently than Clap
14 #[allow(rustdoc::bare_urls)]
16 /// Skip [Y/n] questions positively
17 #[arg(short, long, conflicts_with = "no", global = true)]
20 /// Skip [Y/n] questions negatively
21 #[arg(short, long, global = true)]
24 /// Activate accessibility mode, reducing visual noise
25 #[arg(short = 'A', long, env = "ACCESSIBLE", global = true)]
28 /// Ignores hidden files
29 #[arg(short = 'H', long)]
32 /// Ignores files matched by git's ignore files
33 #[arg(short = 'g', long)]
36 /// Ouch and claps subcommands
37 #[command(subcommand)]
41 #[derive(Parser, PartialEq, Eq, Debug)]
42 #[allow(rustdoc::bare_urls)]
44 /// Compress one or more files into one output file
45 #[command(visible_alias = "c")]
47 /// Files to be compressed
48 #[arg(required = true, num_args = 1..)]
51 /// The resulting file. Its extensions can be used to specify the compression formats
52 #[arg(required = true, value_hint = ValueHint::FilePath)]
55 /// Decompresses one or more files, optionally into another folder
56 #[command(visible_alias = "d")]
58 /// Files to be decompressed
59 #[arg(required = true, num_args = 1..)]
62 /// Place results in a directory other than the current one
63 #[arg(short = 'd', long = "dir", value_hint = ValueHint::DirPath)]
64 output_dir: Option<PathBuf>,
66 /// List contents of an archive
67 #[command(visible_alias = "l")]
69 /// Archives whose contents should be listed
70 #[arg(required = true, num_args = 1..)]
71 archives: Vec<PathBuf>,
73 /// Show archive contents as a tree