diff options
Diffstat (limited to 'src/cli.rs')
-rw-r--r-- | src/cli.rs | 59 |
1 files changed, 59 insertions, 0 deletions
diff --git a/src/cli.rs b/src/cli.rs new file mode 100644 index 0000000..f24b222 --- /dev/null +++ b/src/cli.rs | |||
@@ -0,0 +1,59 @@ | |||
1 | use clap_verbosity_flag; | ||
2 | use clap_log_flag; | ||
3 | use structopt; | ||
4 | |||
5 | #[derive(StructOpt, Debug)] | ||
6 | #[structopt(raw(setting = "structopt::clap::AppSettings::ColoredHelp"))] | ||
7 | /// Hello World! How are you doing? | ||
8 | pub struct Cli { | ||
9 | #[structopt(flatten)] | ||
10 | pub verbose: clap_verbosity_flag::Verbosity, | ||
11 | #[structopt(flatten)] | ||
12 | pub log: clap_log_flag::Log, | ||
13 | #[structopt(short = "s")] | ||
14 | /// Use the given sink. | ||
15 | /// | ||
16 | /// By default it will use the last equalized sink it finds | ||
17 | pub sink: Option<String>, | ||
18 | #[structopt(subcommand)] | ||
19 | pub cmd: Command, | ||
20 | } | ||
21 | |||
22 | #[derive(StructOpt, Debug)] | ||
23 | pub enum Command { | ||
24 | #[structopt(name = "load",)] | ||
25 | /// Load and switch to a given equalizer configuration | ||
26 | Load(LoadCli), | ||
27 | #[structopt(name = "reset")] | ||
28 | /// Switch to a neutral equalizer | ||
29 | Reset(ResetCli), | ||
30 | } | ||
31 | |||
32 | #[derive(StructOpt, Debug)] | ||
33 | pub struct LoadCli { | ||
34 | #[structopt(default_value = "-")] | ||
35 | /// The file from which to load the equalizer configuration | ||
36 | /// | ||
37 | /// If "-" is given, read the configuration from the command-line. | ||
38 | pub file: String, | ||
39 | #[structopt( | ||
40 | short = "f", | ||
41 | raw( | ||
42 | possible_values = "&EqualizerConfFormat::variants()", | ||
43 | case_insensitive = "true" | ||
44 | ), | ||
45 | default_value = "EqualizerAPO" | ||
46 | )] | ||
47 | /// The file format of the equalizer configuration | ||
48 | pub format: EqualizerConfFormat, | ||
49 | } | ||
50 | |||
51 | arg_enum! { | ||
52 | #[derive(Debug)] | ||
53 | pub enum EqualizerConfFormat { | ||
54 | EqualizerAPO | ||
55 | } | ||
56 | } | ||
57 | |||
58 | #[derive(StructOpt, Debug)] | ||
59 | pub struct ResetCli {} | ||