move combined algorithms to function, add -v to readme
This commit is contained in:
parent
317db496cd
commit
633265078f
2 changed files with 18 additions and 13 deletions
|
@ -43,6 +43,9 @@ With no FILE(s) specified, or when FILE is a dash (-), picca will read from stan
|
|||
**-t, ––threads**=_THREADS_
|
||||
: Use at most, at any given time, this number of threads. By default, picca will detect the amount of processors on the system and use that as the thread count. Using 0 for this value results in the default behavior; this is the same as omitting this option.
|
||||
|
||||
**-V, ––version**
|
||||
: Show the version of picca and exit
|
||||
|
||||
The following option is only useful when verifying checksums with the **-c** flag:
|
||||
|
||||
**-q, ––quiet**
|
||||
|
|
28
src/main.rs
28
src/main.rs
|
@ -92,19 +92,7 @@ struct Args {
|
|||
long,
|
||||
help = "Specify an algorithm for hashing",
|
||||
default_value = "sha256",
|
||||
value_parser = {
|
||||
let mut combined: Vec<&str> = vec![];
|
||||
for i in ALGORITHMS {
|
||||
combined.push(i);
|
||||
}
|
||||
|
||||
for i in UNSECURE_ALGORITHMS {
|
||||
combined.push(i);
|
||||
}
|
||||
combined.sort();
|
||||
|
||||
clap::builder::PossibleValuesParser::new(Vec::from(combined))
|
||||
}
|
||||
value_parser = clap::builder::PossibleValuesParser::new(get_algorithms())
|
||||
)]
|
||||
algorithm: String,
|
||||
|
||||
|
@ -144,6 +132,20 @@ struct ThreadInfo {
|
|||
hash_errors: Arc<AtomicI32>,
|
||||
}
|
||||
|
||||
fn get_algorithms() -> Vec<&'static str> {
|
||||
let mut combined: Vec<&str> = vec![];
|
||||
for i in ALGORITHMS {
|
||||
combined.push(i);
|
||||
}
|
||||
|
||||
for i in UNSECURE_ALGORITHMS {
|
||||
combined.push(i);
|
||||
}
|
||||
combined.sort();
|
||||
|
||||
return Vec::from(combined)
|
||||
}
|
||||
|
||||
fn hash(info: ThreadInfo) -> Result<(), String> {
|
||||
loop {
|
||||
let mut stdin = None;
|
||||
|
|
Loading…
Add table
Reference in a new issue