Skip to content

Commit

Permalink
adjusted argument handling and added a version option
Browse files Browse the repository at this point in the history
  • Loading branch information
Tresquel committed Feb 16, 2024
1 parent 5799458 commit 35fee13
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,15 @@ A command line tool to generate CD, Office and OEM keys that use the mod7 algori
I used [this blog post](https://gurney.dev/posts/mod7/) to figure out how these keys work and how to generate them

# Usage
`mod7-keygen {-cd | -office | -oem} <integer>`
`mod7-keygen { --cd | --office | --oem } <integer>` or `mod7-keygen { -c | -e | -o } <integer>`
- The integer is optional, it specifies the amount of keys to generate.

`mod7-keygen --check <string>`
- Checks if the provided key is valid.

`mod7-keygen { --version | -v }`
- Prints the version of the program

# Building
Make sure you have Rust and Git installed
- `git clone https://github.com/Tresquel/mod7-keygen.git`
Expand Down
15 changes: 11 additions & 4 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ fn main() {
}

match args[1].to_lowercase().as_str() {
"-cd" => {
"--cd" | "-c" => {
println!("Generated CD key(s): ");
for _ in 0..amount {
println!("{}", generator::cd());
Expand All @@ -42,7 +42,7 @@ fn main() {
return;
}

"-office" => {
"--office" | "-e" => {
println!("Generated Office key(s): ");
for _ in 0..amount {
println!("{}", generator::office());
Expand All @@ -51,7 +51,7 @@ fn main() {
return;
}

"-oem" => {
"--oem" | "-o" => {
println!("Generated OEM key(s): ");
for _ in 0..amount {
println!("{}", generator::oem());
Expand All @@ -77,10 +77,16 @@ fn main() {

}

"-help" => {
"--help" | "-h" => {
help();
return;
}

"--version" | "-v" => {
println!("mod7-keygen version 1.1.0");
return;
}

_ => {
eprintln!("Invalid argument(s)!");
help();
Expand All @@ -92,6 +98,7 @@ fn main() {
_ => {
eprintln!("Invalid argument(s)!");
help();
return;
}
}
}

0 comments on commit 35fee13

Please sign in to comment.