MCPcopy Create free account
hub / github.com/PerroEngine/Perro / print_usage

Function print_usage

perro_source/devtools/perro_cli/src/main.rs:94–150  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

92 "clippy" => clippy_command(&args, &cwd),
93 _ => {
94 print_usage();
95 Err(format!("unknown command `{command}`"))
96 }
97 }
98 };
99
100 if let Err(err) = result {
101 eprintln!("{err}");
102 std::process::exit(1);
103 }
104}
105
106#[derive(Clone, Copy)]
107enum FlagArity {
108 Switch,
109 Value,
110 OptionalValue,
111}
112
113#[derive(Clone, Copy)]
114struct FlagSpec {
115 name: &'static str,
116 arity: FlagArity,
117}
118
119const fn switch(name: &'static str) -> FlagSpec {
120 FlagSpec {
121 name,
122 arity: FlagArity::Switch,
123 }
124}
125
126const fn value(name: &'static str) -> FlagSpec {
127 FlagSpec {
128 name,
129 arity: FlagArity::Value,
130 }
131}
132
133const fn optional_value(name: &'static str) -> FlagSpec {
134 FlagSpec {
135 name,
136 arity: FlagArity::OptionalValue,
137 }
138}
139
140const PATH: &[FlagSpec] = &[value("--path")];
141const NEW: &[FlagSpec] = &[value("--path"), value("--name")];
142const NEW_DLC: &[FlagSpec] = &[value("--path"), value("--name"), switch("--no-open")];
143const NEW_SCRIPT: &[FlagSpec] = &[
144 value("--path"),
145 value("--name"),
146 value("--res"),
147 value("--dlc"),
148 switch("--no-open"),
149];
150const NEW_SCENE: &[FlagSpec] = &[
151 value("--path"),

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected