|
1 | | -use std::fmt; |
2 | | -use std::{path::Path, str::FromStr}; |
| 1 | +use std::{fmt, path::Path, str::FromStr}; |
3 | 2 |
|
4 | 3 | use clap::Parser; |
5 | 4 |
|
6 | | -#[derive(Debug, Parser)] |
7 | | -#[command(name = "rcli", version, author, about, long_about = None)] |
8 | | -pub struct Opts { |
9 | | - #[command(subcommand)] |
10 | | - pub cmd: SubCommand, |
11 | | -} |
12 | | - |
13 | | -#[derive(Debug, Parser)] |
14 | | -pub enum SubCommand { |
15 | | - #[command(name = "csv", about = "Show CSV, or convert CSV to other formats")] |
16 | | - Csv(CsvOpts), |
17 | | - |
18 | | - #[command(name = "genpass", about = "Generate a random password")] |
19 | | - GenPass(GenPassOpts), |
20 | | -} |
21 | | - |
22 | 5 | #[derive(Debug, Clone, Copy)] |
23 | 6 | pub enum OutputFormat { |
24 | 7 | Json, |
@@ -78,24 +61,6 @@ pub struct CsvOpts { |
78 | 61 | pub delimiter: char, |
79 | 62 | } |
80 | 63 |
|
81 | | -#[derive(Debug, Parser)] |
82 | | -pub struct GenPassOpts { |
83 | | - #[arg(short, long, help = "Length of the password", default_value_t = 12)] |
84 | | - pub length: u8, |
85 | | - |
86 | | - #[arg(long = "no-uppercase", help = "Exclude uppercase characters", default_value_t = true, action = clap::ArgAction::SetFalse)] |
87 | | - pub uppercase: bool, |
88 | | - |
89 | | - #[arg(long = "no-lowercase", help = "Exclude lowercase characters", default_value_t = true, action = clap::ArgAction::SetFalse)] |
90 | | - pub lowercase: bool, |
91 | | - |
92 | | - #[arg(long = "no-numbers", help = "Exclude numbers", default_value_t = true, action = clap::ArgAction::SetFalse)] |
93 | | - pub numbers: bool, |
94 | | - |
95 | | - #[arg(long = "no-special", help = "Exclude special characters", default_value_t = true, action = clap::ArgAction::SetFalse)] |
96 | | - pub special: bool, |
97 | | -} |
98 | | - |
99 | 64 | fn verify_input_file(filename: &str) -> Result<String, String> { |
100 | 65 | if Path::new(filename).exists() { |
101 | 66 | Ok(filename.to_string()) |
|
0 commit comments