summaryrefslogtreecommitdiffstats
path: root/src/main.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/main.rs')
-rw-r--r--src/main.rs60
1 files changed, 3 insertions, 57 deletions
diff --git a/src/main.rs b/src/main.rs
index 360117c..85d2443 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -14,75 +14,21 @@ extern crate structopt;
14 14
15extern crate lalrpop_util; 15extern crate lalrpop_util;
16 16
17mod cli;
17mod dbus_api; 18mod dbus_api;
18mod parsing; 19mod parsing;
19mod utils; 20mod utils;
20 21
21use utils::*; 22use utils::*;
22
23use dbus_api::sink::OrgPulseAudioExtEqualizing1Equalizer; 23use dbus_api::sink::OrgPulseAudioExtEqualizing1Equalizer;
24use cli::*;
25
24use failure::Error; 26use failure::Error;
25use structopt::StructOpt; 27use structopt::StructOpt;
26 28
27use std::fs::File; 29use std::fs::File;
28use std::io; 30use std::io;
29 31
30#[derive(StructOpt, Debug)]
31#[structopt(raw(setting = "structopt::clap::AppSettings::ColoredHelp"))]
32/// Hello World! How are you doing?
33struct Cli {
34 #[structopt(flatten)]
35 verbose: clap_verbosity_flag::Verbosity,
36 #[structopt(flatten)]
37 log: clap_log_flag::Log,
38 #[structopt(short = "s")]
39 /// Use the given sink.
40 ///
41 /// By default it will use the last equalized sink it finds
42 sink: Option<String>,
43 #[structopt(subcommand)]
44 cmd: Command,
45}
46
47#[derive(StructOpt, Debug)]
48enum Command {
49 #[structopt(name = "load",)]
50 /// Load and switch to a given equalizer configuration
51 Load(LoadCli),
52 #[structopt(name = "reset")]
53 /// Switch to a neutral equalizer
54 Reset(ResetCli),
55}
56
57#[derive(StructOpt, Debug)]
58struct LoadCli {
59 #[structopt(default_value = "-")]
60 /// The file from which to load the equalizer configuration
61 ///
62 /// If "-" is given, read the configuration from the command-line.
63 file: String,
64 #[structopt(
65 short = "f",
66 raw(
67 possible_values = "&EqualizerConfFormat::variants()",
68 case_insensitive = "true"
69 ),
70 default_value = "EqualizerAPO"
71 )]
72 /// The file format of the equalizer configuration
73 format: EqualizerConfFormat,
74}
75
76arg_enum! {
77 #[derive(Debug)]
78 enum EqualizerConfFormat {
79 EqualizerAPO
80 }
81}
82
83#[derive(StructOpt, Debug)]
84struct ResetCli {}
85
86#[derive(Debug)] 32#[derive(Debug)]
87pub struct Filter { 33pub struct Filter {
88 preamp: f64, 34 preamp: f64,