Skip to content

Commit ce20382

Browse files
author
typable
committed
Added help command
1 parent 7ed9ce1 commit ce20382

File tree

2 files changed

+10
-0
lines changed

2 files changed

+10
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,3 +48,4 @@ All arguments can be use independently with each other.
4848
|**--level [-l]**|Specifies the depth of the tree|`--level=0`|
4949
|**--out [-o]**|Specifies the output file|`--out=tree.txt`|
5050
|**--all [-a]**|Shows all `.*` files and directories|`--all`|
51+
|**--help [-h]**|Shows a list of all commands||

src/main.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,15 @@ fn main() {
5757
arg if arg.starts_with("-a") || arg.starts_with("--all") => {
5858
all = true;
5959
},
60+
arg if arg.starts_with("-h") || arg.starts_with("--help") => {
61+
println!("A list of all commands:");
62+
println!("{}", format!("{: <10}{: <8}{}", "--path", "[-p]", "Specifies the to be used path"));
63+
println!("{}", format!("{: <10}{: <8}{}", "--level", "[-l]", "Specifies the depth of the tree"));
64+
println!("{}", format!("{: <10}{: <8}{}", "--out", "[-o]", "Specifies the output file"));
65+
println!("{}", format!("{: <10}{: <8}{}", "--all", "[-a]", "Shows all '.*' files and directories"));
66+
println!("{}", format!("{: <10}{: <8}{}", "--help", "[-h]", "Shows a list of all commands"));
67+
return;
68+
},
6069
_ => {
6170
println!("Error: Unknown argument '{}'!", arg);
6271
return;

0 commit comments

Comments
 (0)