show default controller in output

This commit is contained in:
crapStone 2022-07-16 02:22:57 +02:00
parent 96f92e0d3f
commit fcc49740c7
No known key found for this signature in database
GPG key ID: 4CAA9E39EEDEB1F0
2 changed files with 6 additions and 7 deletions

View file

@ -3,7 +3,7 @@
// You should have received a copy of the GNU General Public License // You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>. // along with this program. If not, see <https://www.gnu.org/licenses/>.
use clap::{App, Arg, ArgGroup}; use clap::{App, Arg};
pub fn build_cli() -> App<'static> { pub fn build_cli() -> App<'static> {
App::new("lamp") App::new("lamp")
@ -53,16 +53,12 @@ pub fn build_cli() -> App<'static> {
.long("full") .long("full")
.help("Sets brightness to highest value"), .help("Sets brightness to highest value"),
) )
.group(
ArgGroup::with_name("brightness_control")
.args(&["set", "inc", "dec", "get", "zero", "full"]),
)
.arg( .arg(
Arg::with_name("list") Arg::with_name("list")
.short('l') .short('l')
.long("list") .long("list")
.help("Lists all available brightness and led controllers") .help("Lists all available brightness and led controllers")
.conflicts_with_all(&["brightness_control"]), .exclusive(true)
) )
.arg( .arg(
Arg::with_name("ctrl_type") Arg::with_name("ctrl_type")

View file

@ -27,8 +27,11 @@ fn main() {
}; };
if matches.is_present("list") { if matches.is_present("list") {
println!("{default_ctrl} [default]");
for ctrl in ctrls.keys() { for ctrl in ctrls.keys() {
println!("{ctrl}"); if ctrl != &default_ctrl {
println!("{ctrl}");
}
} }
exit(exitcode::OK); exit(exitcode::OK);
} else if let Some(value) = matches.value_of("set") { } else if let Some(value) = matches.value_of("set") {