Use can set functions in cli app

This commit is contained in:
Lennard Kittner
2025-11-08 13:26:43 +01:00
parent fc01eee908
commit eb304eda01

View File

@@ -24,7 +24,7 @@ fn main() {
.help( .help(
"Set the delay in minutes after which the headset will automatically shutdown.\n0 will disable automatic shutdown.", "Set the delay in minutes after which the headset will automatically shutdown.\n0 will disable automatic shutdown.",
) )
.hide(device.set_automatic_shut_down_packet(Duration::from_secs(0)).is_none()) .hide(!device.can_set_automatic_shutdown())
.value_parser(clap::value_parser!(u8)), .value_parser(clap::value_parser!(u8)),
) )
.arg( .arg(
@@ -32,7 +32,7 @@ fn main() {
.long("mute") .long("mute")
.required(false) .required(false)
.help("Mute or unmute the headset.") .help("Mute or unmute the headset.")
.hide(device.set_mute_packet(false).is_none()) .hide(!device.can_set_mute())
.value_parser(clap::value_parser!(bool)), .value_parser(clap::value_parser!(bool)),
) )
.arg( .arg(
@@ -40,7 +40,7 @@ fn main() {
.long("enable_side_tone") .long("enable_side_tone")
.required(false) .required(false)
.help("Enable or disable side tone.") .help("Enable or disable side tone.")
.hide(device.set_side_tone_packet(false).is_none()) .hide(!device.can_set_side_tone())
.value_parser(clap::value_parser!(bool)), .value_parser(clap::value_parser!(bool)),
) )
.arg( .arg(
@@ -48,7 +48,7 @@ fn main() {
.long("side_tone_volume") .long("side_tone_volume")
.required(false) .required(false)
.help("Set the side tone volume.") .help("Set the side tone volume.")
.hide(device.set_side_tone_volume_packet(0).is_none()) .hide(!device.can_set_side_tone_volume())
.value_parser(clap::value_parser!(u8)), .value_parser(clap::value_parser!(u8)),
) )
.arg( .arg(
@@ -56,7 +56,7 @@ fn main() {
.long("enable_voice_prompt") .long("enable_voice_prompt")
.required(false) .required(false)
.help("Enable voice prompt. This may not be supported on your device.") .help("Enable voice prompt. This may not be supported on your device.")
.hide(device.set_voice_prompt_packet(false).is_none()) .hide(!device.can_set_voice_prompt())
.value_parser(clap::value_parser!(bool)), .value_parser(clap::value_parser!(bool)),
) )
.arg( .arg(
@@ -64,7 +64,7 @@ fn main() {
.long("surround_sound") .long("surround_sound")
.required(false) .required(false)
.help("Enables surround sound. This may be on by default and cannot be changed on your device.") .help("Enables surround sound. This may be on by default and cannot be changed on your device.")
.hide(device.set_surround_sound_packet(false).is_none()) .hide(!device.can_set_surround_sound())
.value_parser(clap::value_parser!(bool)), .value_parser(clap::value_parser!(bool)),
) )
.arg( .arg(
@@ -72,7 +72,7 @@ fn main() {
.long("mute_playback") .long("mute_playback")
.required(false) .required(false)
.help("Mute or unmute playback.") .help("Mute or unmute playback.")
.hide(device.set_silent_mode_packet(false).is_none()) .hide(!device.can_set_silent_mode())
.value_parser(clap::value_parser!(bool)), .value_parser(clap::value_parser!(bool)),
) )
.get_matches(); .get_matches();