-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Mamontov
committed
Nov 30, 2024
1 parent
d450d20
commit 3a4308e
Showing
2 changed files
with
35 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,36 @@ | ||
use passgenlib::Passgen; | ||
use clap::{arg, command, value_parser, Arg, ColorChoice, Parser}; | ||
|
||
/*#[derive(Parser, Debug)] | ||
#[command(version, about, long_about = None)] | ||
struct Args { | ||
/// Name of the person to greet | ||
#[arg(short, long)] | ||
name: String, | ||
/// Number of times to greet | ||
#[arg(short, long, default_value_t = 1)] | ||
count: u8, | ||
}*/ | ||
|
||
fn main() { | ||
println!("{}", Passgen::default_strong_and_usab().generate(8)) | ||
|
||
|
||
|
||
let matches = command!() | ||
.arg( | ||
arg!([length]) | ||
.value_parser(value_parser!(u32)) | ||
.default_value("8"), | ||
) | ||
.color(ColorChoice::Always) | ||
.get_matches(); | ||
|
||
let length: &u32 = matches | ||
.get_one::<u32>("length") | ||
.expect("length must be provided"); | ||
|
||
println!("{}", Passgen::default().generate(*length)); | ||
|
||
|
||
} |