summaryrefslogtreecommitdiffstats
path: root/src/cli.rs
blob: f24b222217e13ebdf408a429bc3bf9584f980aeb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
use clap_verbosity_flag;
use clap_log_flag;
use structopt;

#[derive(StructOpt, Debug)]
#[structopt(raw(setting = "structopt::clap::AppSettings::ColoredHelp"))]
/// Hello World! How are you doing?
pub struct Cli {
    #[structopt(flatten)]
    pub verbose: clap_verbosity_flag::Verbosity,
    #[structopt(flatten)]
    pub log: clap_log_flag::Log,
    #[structopt(short = "s")]
    /// Use the given sink.
    ///
    /// By default it will use the last equalized sink it finds
    pub sink: Option<String>,
    #[structopt(subcommand)]
    pub cmd: Command,
}

#[derive(StructOpt, Debug)]
pub enum Command {
    #[structopt(name = "load",)]
    /// Load and switch to a given equalizer configuration
    Load(LoadCli),
    #[structopt(name = "reset")]
    /// Switch to a neutral equalizer
    Reset(ResetCli),
}

#[derive(StructOpt, Debug)]
pub struct LoadCli {
    #[structopt(default_value = "-")]
    /// The file from which to load the equalizer configuration
    ///
    /// If "-" is given, read the configuration from the command-line.
    pub file: String,
    #[structopt(
        short = "f",
        raw(
            possible_values = "&EqualizerConfFormat::variants()",
            case_insensitive = "true"
        ),
        default_value = "EqualizerAPO"
    )]
    /// The file format of the equalizer configuration
    pub format: EqualizerConfFormat,
}

arg_enum! {
    #[derive(Debug)]
    pub enum EqualizerConfFormat {
        EqualizerAPO
    }
}

#[derive(StructOpt, Debug)]
pub struct ResetCli {}