diff --git a/src/cli.rs b/src/cli.rs index ca49ce5..893a3c5 100644 --- a/src/cli.rs +++ b/src/cli.rs @@ -3,7 +3,7 @@ // You should have received a copy of the GNU General Public License // along with this program. If not, see . -use clap::{App, Arg, ArgGroup}; +use clap::{App, Arg}; pub fn build_cli() -> App<'static> { App::new("lamp") @@ -53,16 +53,12 @@ pub fn build_cli() -> App<'static> { .long("full") .help("Sets brightness to highest value"), ) - .group( - ArgGroup::with_name("brightness_control") - .args(&["set", "inc", "dec", "get", "zero", "full"]), - ) .arg( Arg::with_name("list") .short('l') .long("list") .help("Lists all available brightness and led controllers") - .conflicts_with_all(&["brightness_control"]), + .exclusive(true) ) .arg( Arg::with_name("ctrl_type") diff --git a/src/main.rs b/src/main.rs index 2653096..aa37e9f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -27,8 +27,11 @@ fn main() { }; if matches.is_present("list") { + println!("{default_ctrl} [default]"); for ctrl in ctrls.keys() { - println!("{ctrl}"); + if ctrl != &default_ctrl { + println!("{ctrl}"); + } } exit(exitcode::OK); } else if let Some(value) = matches.value_of("set") {