summaryrefslogtreecommitdiffstats
path: root/src/cli.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/cli.rs')
-rw-r--r--src/cli.rs113
1 files changed, 86 insertions, 27 deletions
diff --git a/src/cli.rs b/src/cli.rs
index f24b222..4a499b5 100644
--- a/src/cli.rs
+++ b/src/cli.rs
@@ -21,31 +21,16 @@ pub struct Cli {
21 21
22#[derive(StructOpt, Debug)] 22#[derive(StructOpt, Debug)]
23pub enum Command { 23pub enum Command {
24 #[structopt(name = "load",)] 24 #[structopt(name = "pa-eq")]
25 /// Load and switch to a given equalizer configuration 25 /// PulseAudio equalizer related commands
26 Load(LoadCli), 26 ///
27 #[structopt(name = "reset")] 27 /// Warning: the PulseAudio equalizer has been deprecated for a while,
28 /// Switch to a neutral equalizer 28 /// and is known to sometimes cause crashes, latency or audible
29 Reset(ResetCli), 29 /// artifacts
30} 30 PaEq(pa_eq::Command),
31 31 #[structopt(name = "pa-effects")]
32#[derive(StructOpt, Debug)] 32 /// PulseEffects equalizer related commands
33pub struct LoadCli { 33 PaEffects(pa_effects::Command),
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} 34}
50 35
51arg_enum! { 36arg_enum! {
@@ -55,5 +40,79 @@ arg_enum! {
55 } 40 }
56} 41}
57 42
58#[derive(StructOpt, Debug)] 43pub mod pa_eq {
59pub struct ResetCli {} 44 use super::EqualizerConfFormat;
45
46 #[derive(StructOpt, Debug)]
47 pub enum Command {
48 #[structopt(name = "load",)]
49 /// Load and switch to a given equalizer configuration
50 Load(LoadCli),
51 #[structopt(name = "reset")]
52 /// Switch to a neutral equalizer
53 Reset(ResetCli),
54 }
55
56 #[derive(StructOpt, Debug)]
57 pub struct LoadCli {
58 #[structopt(default_value = "-")]
59 /// The file from which to load the equalizer configuration
60 ///
61 /// If "-" is given, read the configuration from the command-line.
62 pub file: String,
63 #[structopt(
64 short = "f",
65 raw(
66 possible_values = "&EqualizerConfFormat::variants()",
67 case_insensitive = "true"
68 ),
69 default_value = "EqualizerAPO"
70 )]
71 /// The file format of the equalizer configuration
72 pub format: EqualizerConfFormat,
73 }
74
75 #[derive(StructOpt, Debug)]
76 pub struct ResetCli {}
77
78}
79
80pub mod pa_effects {
81 use super::EqualizerConfFormat;
82
83 #[derive(StructOpt, Debug)]
84 pub enum Command {
85 #[structopt(name = "export-preset",)]
86 /// Export a PulseEffects preset
87 ExportPreset(ExportPresetCli),
88 }
89
90 #[derive(StructOpt, Debug)]
91 pub struct ExportPresetCli {
92 #[structopt(default_value = "-")]
93 /// The file from which to load the equalizer configuration
94 ///
95 /// If "-" is given, read the configuration from the command-line.
96 pub file: String,
97 #[structopt(
98 short = "f",
99 raw(
100 possible_values = "&EqualizerConfFormat::variants()",
101 case_insensitive = "true"
102 ),
103 default_value = "EqualizerAPO"
104 )]
105 /// The file format of the equalizer configuration
106 pub format: EqualizerConfFormat,
107 #[structopt(short = "p")]
108 /// Use a given file as a base for PulseEffects preset instead of the
109 /// default one.
110 ///
111 /// If "-" is given, read the base preset from the command-line.
112 pub base_preset: Option<String>,
113 #[structopt(short = "o")]
114 /// Write the preset to the given file, instead of the standard output
115 pub output: Option<String>,
116 }
117
118}