diff options
author | Minijackson <minijackson@riseup.net> | 2020-01-04 12:23:17 +0100 |
---|---|---|
committer | Minijackson <minijackson@riseup.net> | 2020-01-04 12:23:17 +0100 |
commit | 557074fb6dadf89ddbfce11d67fe8cac0f9eed80 (patch) | |
tree | d2348f24f00663dbe71daa335898a7c00dbef191 /src | |
parent | 2df39381388fcf181332cc2759a879578b69954c (diff) | |
download | set_eq-557074fb6dadf89ddbfce11d67fe8cac0f9eed80.tar.gz set_eq-557074fb6dadf89ddbfce11d67fe8cac0f9eed80.zip |
Update most dependencies, remove the clap-* ones
Diffstat (limited to 'src')
-rw-r--r-- | src/cli.rs | 28 | ||||
-rw-r--r-- | src/main.rs | 17 |
2 files changed, 23 insertions, 22 deletions
@@ -1,15 +1,15 @@ | |||
1 | use clap_log_flag; | ||
2 | use clap_verbosity_flag; | ||
3 | use structopt; | 1 | use structopt; |
2 | use structopt::clap::arg_enum; | ||
4 | 3 | ||
5 | #[derive(StructOpt, Debug)] | 4 | #[derive(StructOpt, Debug)] |
6 | #[structopt(raw(setting = "structopt::clap::AppSettings::ColoredHelp"))] | ||
7 | /// A command-line tool to manipulate PulseAudio's equalizers | 5 | /// A command-line tool to manipulate PulseAudio's equalizers |
8 | pub struct Cli { | 6 | pub struct Cli { |
9 | #[structopt(flatten)] | 7 | #[structopt(long, short, parse(from_occurrences))] |
10 | pub verbose: clap_verbosity_flag::Verbosity, | 8 | /// Pass many times for more log output |
11 | #[structopt(flatten)] | 9 | /// |
12 | pub log: clap_log_flag::Log, | 10 | /// By default, it'll only report errors and warnings. Passing `-v` one time |
11 | /// also prints infos, `-vv` enables debug logging, and `-vvv` trace. | ||
12 | pub verbose: u8, | ||
13 | #[structopt(subcommand)] | 13 | #[structopt(subcommand)] |
14 | pub cmd: Command, | 14 | pub cmd: Command, |
15 | } | 15 | } |
@@ -61,10 +61,8 @@ pub mod pa_eq { | |||
61 | #[structopt( | 61 | #[structopt( |
62 | short = "f", | 62 | short = "f", |
63 | long = "format", | 63 | long = "format", |
64 | raw( | 64 | possible_values = &EqualizerConfFormat::variants(), |
65 | possible_values = "&EqualizerConfFormat::variants()", | 65 | case_insensitive = true, |
66 | case_insensitive = "true" | ||
67 | ), | ||
68 | default_value = "EqualizerAPO" | 66 | default_value = "EqualizerAPO" |
69 | )] | 67 | )] |
70 | /// The file format of the equalizer configuration | 68 | /// The file format of the equalizer configuration |
@@ -84,7 +82,6 @@ pub mod pa_eq { | |||
84 | /// By default it will use the last equalized sink it finds | 82 | /// By default it will use the last equalized sink it finds |
85 | pub sink: Option<String>, | 83 | pub sink: Option<String>, |
86 | } | 84 | } |
87 | |||
88 | } | 85 | } |
89 | 86 | ||
90 | #[cfg(feature = "pa-effects")] | 87 | #[cfg(feature = "pa-effects")] |
@@ -108,10 +105,8 @@ pub mod pa_effects { | |||
108 | #[structopt( | 105 | #[structopt( |
109 | short = "f", | 106 | short = "f", |
110 | long = "format", | 107 | long = "format", |
111 | raw( | 108 | possible_values = &EqualizerConfFormat::variants(), |
112 | possible_values = "&EqualizerConfFormat::variants()", | 109 | case_insensitive = true, |
113 | case_insensitive = "true" | ||
114 | ), | ||
115 | default_value = "EqualizerAPO" | 110 | default_value = "EqualizerAPO" |
116 | )] | 111 | )] |
117 | /// The file format of the equalizer configuration | 112 | /// The file format of the equalizer configuration |
@@ -126,5 +121,4 @@ pub mod pa_effects { | |||
126 | /// Write the preset to the given file instead of the standard output | 121 | /// Write the preset to the given file instead of the standard output |
127 | pub output: Option<String>, | 122 | pub output: Option<String>, |
128 | } | 123 | } |
129 | |||
130 | } | 124 | } |
diff --git a/src/main.rs b/src/main.rs index 23d5a19..062a77c 100644 --- a/src/main.rs +++ b/src/main.rs | |||
@@ -4,10 +4,6 @@ extern crate log; | |||
4 | extern crate failure; | 4 | extern crate failure; |
5 | 5 | ||
6 | #[macro_use] | 6 | #[macro_use] |
7 | extern crate clap; | ||
8 | |||
9 | |||
10 | #[macro_use] | ||
11 | extern crate structopt; | 7 | extern crate structopt; |
12 | 8 | ||
13 | #[macro_use] | 9 | #[macro_use] |
@@ -74,7 +70,18 @@ fn main() { | |||
74 | 70 | ||
75 | fn start() -> Result<(), Error> { | 71 | fn start() -> Result<(), Error> { |
76 | let args = Cli::from_args(); | 72 | let args = Cli::from_args(); |
77 | args.log.log_all(Some(args.verbose.log_level()))?; | 73 | pretty_env_logger::formatted_builder() |
74 | .filter( | ||
75 | None, | ||
76 | match args.verbose { | ||
77 | 0 => log::LevelFilter::Warn, | ||
78 | 1 => log::LevelFilter::Info, | ||
79 | 2 => log::LevelFilter::Debug, | ||
80 | _ => log::LevelFilter::Trace, | ||
81 | }, | ||
82 | ) | ||
83 | .try_init()?; | ||
84 | |||
78 | 85 | ||
79 | use crate::Command::*; | 86 | use crate::Command::*; |
80 | 87 | ||