mirror of
https://codeberg.org/Codeberg/pages-server.git
synced 2025-01-19 08:57:55 +00:00
show default controller in output
This commit is contained in:
parent
96f92e0d3f
commit
fcc49740c7
2 changed files with 6 additions and 7 deletions
|
@ -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")
|
||||
|
|
|
@ -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();
|
||||
|
|
Loading…
Reference in a new issue