batman_robin/cli/bridge_loop_avoidance.rs
1use clap::{Arg, Command};
2
3/// Creates the CLI command for querying or modifying the bridge loop avoidance setting.
4///
5/// # Returns
6/// - A `clap::Command` configured with:
7/// - Name: `"bridge_loop_avoidance"`
8/// - Alias: `"bl"`
9/// - Short and long description: `"Display or modify bridge_loop_avoidance setting."`
10/// - Usage override: `robctl [options] bridge_loop_avoidance|bl [options] [0|1]`
11/// - Optional argument `value`:
12/// - Type: `u8`
13/// - Allowed values: `0` (disable) or `1` (enable)
14/// - Help: `"0 = disable bridge_loop_avoidance, 1 = enable bridge_loop_avoidance"`
15///
16/// # Notes
17/// - If no `value` is provided, the command can be used to display the current bridge loop avoidance state.
18/// - Version flag is disabled for this command.
19pub fn cmd_bridge_loop_avoidance() -> Command {
20 Command::new("bridge_loop_avoidance")
21 .alias("bl")
22 .about("Display or modify bridge_loop_avoidance setting.")
23 .long_about("Display or modify bridge_loop_avoidance setting.")
24 .override_usage("\trobctl [options] bridge_loop_avoidance|bl [options] [0|1]\n")
25 .arg(
26 Arg::new("value")
27 .value_name("0|1")
28 .required(false)
29 .value_parser(clap::value_parser!(u8).range(0..=1))
30 .help("0 = disable bridge_loop_avoidance, 1 = enable bridge_loop_avoidance"),
31 )
32 .disable_version_flag(true)
33}