Library/Fn/Binary/
Command.rs

1/// Creates and returns the command-line argument matches for the `Rest`
2/// application.
3///
4/// This function sets up the command-line interface using the `clap` crate,
5
6/// defining various arguments and their properties such as short and long
7/// names, help messages, default values, and whether they are required.
8///
9/// # Returns
10///
11/// Returns an `ArgMatches` instance containing the parsed command-line
12/// arguments.
13///
14/// # Argument
15///
16/// * `Exclude` - An optional argument to specify patterns to exclude. Default
17///   is "node_modules".
18/// * `Parallel` - An optional flag to enable parallel processing.
19/// * `Pattern` - An optional argument to specify a pattern to match. Default is
20///   ".git".
21/// * `Root` - An optional argument to specify the root directory. Default is
22///   ".".
23///
24/// # Example
25///
26/// ```rust
27/// let matches = Fn();
28
29/// let exclude = matches.value_of("Exclude").unwrap_or("node_modules");
30
31/// let parallel = matches.is_present("Parallel");
32
33/// let pattern = matches.value_of("Pattern").unwrap_or(".git");
34
35/// let root = matches.value_of("Root").unwrap_or(".");
36
37/// ```
38/// 
39/// # Errors
40///
41/// This function will panic if there are issues with the argument definitions
42/// or parsing.
43pub fn Fn() -> ArgMatches {
44	Command::new("Rest")
45		.version(env!("CARGO_PKG_VERSION"))
46		.author("Source 🖋️ Open 👐🏻 <Source/Open@PlayForm.Cloud>")
47		.about("Rest ⛱️")
48		.arg(
49			Arg::new("Exclude")
50				.short('E')
51				.long("Exclude")
52				.display_order(4)
53				.value_name("EXCLUDE")
54				.required(false)
55				.help("Exclude 🚫")
56				.default_value("node_modules"),
57		)
58		.arg(
59			Arg::new("Parallel")
60				.short('P')
61				.long("Parallel")
62				.action(SetTrue)
63				.display_order(2)
64				.value_name("PARALLEL")
65				.required(false)
66				.help("Parallel ⏩"),
67		)
68		.arg(
69			Arg::new("Pattern")
70				.long("Pattern")
71				.display_order(5)
72				.value_name("PATTERN")
73				.required(false)
74				.help("Pattern 🔍")
75				.default_value(".git"),
76		)
77		.arg(
78			Arg::new("Root")
79				.short('R')
80				.long("Root")
81				.display_order(3)
82				.value_name("ROOT")
83				.required(false)
84				.help("Root 📂")
85				.default_value("."),
86		)
87		.get_matches()
88}
89
90use clap::{Arg, ArgAction::SetTrue, ArgMatches, Command};
91
92pub mod Entry;
93
94pub mod Parallel;
95
96pub mod Sequential;