Skip to content

Commit a13a032

Browse files
committed
src/lib.rs:gnostr-command install <empty_string>
1 parent d07f329 commit a13a032

File tree

1 file changed

+41
-35
lines changed

1 file changed

+41
-35
lines changed

src/lib.rs

Lines changed: 41 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -209,41 +209,47 @@ impl Config {
209209
#[cfg(debug_assertions)]
210210
println!("arg=banana:{}", arg.eq(&banana));
211211

212-
if content.eq(&install) {
213-
#[cfg(debug_assertions)]
214-
println!("exec install sub argparse {:?}!", arg);
215-
let content = String::from(&args[2].clone());
216-
if content.eq(&gnostr_cat) {
217-
//#[cfg(debug_assertions)]
218-
println!("exec gnostr-cat install {:?}!", args);
219-
220-
}
221-
if content.eq(&gnostr_cli) {
222-
//#[cfg(debug_assertions)]
223-
println!("exec gnostr-cli install {:?}!", args);
224-
225-
}
226-
if content.eq(&gnostr_command) {
227-
//#[cfg(debug_assertions)]
228-
println!("exec gnostr-command install {:?}!", args);
229-
230-
}
231-
if content.eq(&gnostr_grep) {
232-
//#[cfg(debug_assertions)]
233-
println!("exec gnostr-grep install {:?}!", args);
234-
235-
}
236-
if content.eq(&gnostr_legit) {
237-
//#[cfg(debug_assertions)]
238-
println!("exec gnostr-legit install {:?}!", args);
239-
240-
}
241-
if content.eq(&gnostr_sha256) {
242-
//#[cfg(debug_assertions)]
243-
println!("exec gnostr-sha256 install {:?}!", args);
244-
245-
}
246-
}// end if content.eq(&install)
212+
if args.len() == 3 {// gnostr-command install gnostr-*
213+
// must be args.len() == 3
214+
if content.eq(&install) {
215+
#[cfg(debug_assertions)]
216+
println!("exec install sub argparse {:?}!", arg);
217+
let content = String::from(&args[2].clone());
218+
if content.eq(&gnostr_cat) {
219+
//#[cfg(debug_assertions)]
220+
println!("exec gnostr-cat install {:?}!", args);
221+
222+
}
223+
if content.eq(&gnostr_cli) {
224+
//#[cfg(debug_assertions)]
225+
println!("exec gnostr-cli install {:?}!", args);
226+
227+
}
228+
if content.eq(&gnostr_command) {
229+
//#[cfg(debug_assertions)]
230+
println!("exec gnostr-command install {:?}!", args);
231+
232+
}
233+
if content.eq(&gnostr_grep) {
234+
//#[cfg(debug_assertions)]
235+
println!("exec gnostr-grep install {:?}!", args);
236+
237+
}
238+
if content.eq(&gnostr_legit) {
239+
//#[cfg(debug_assertions)]
240+
println!("exec gnostr-legit install {:?}!", args);
241+
242+
}
243+
if content.eq(&gnostr_sha256) {
244+
//#[cfg(debug_assertions)]
245+
println!("exec gnostr-sha256 install {:?}!", args);
246+
247+
}
248+
}// end if content.eq(&install)
249+
}// end if args.len() == 3
250+
251+
//reinitialize content as args[1]
252+
let content = String::from(&args[1].clone());
247253

248254
if content.eq(&_ferris) {
249255
println!("Matched {:?}!", arg);

0 commit comments

Comments
 (0)