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
// 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> {
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")

View file

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