commit a4f410d9500b9babe01f7d6ae891e8cd3377deed from: witcher date: Sat Apr 22 15:53:21 2023 UTC use subcommands commit - 510b79eba6902f991d857c5b41f6291466dabe00 commit + a4f410d9500b9babe01f7d6ae891e8cd3377deed blob - 1b4c60656b86f81cf8ace1d49bbb966e1a65f72e blob + 1a44f0ccf6ce98c28933541eab3bb7dd5fef7b47 --- src/main.rs +++ src/main.rs @@ -2,22 +2,27 @@ // // SPDX-License-Identifier: GPL-3.0-only -use clap::Parser; +use clap::{Parser, Subcommand}; use raur::Raur; #[derive(Debug, Clone, Parser)] -#[clap(author, version, about)] +#[command(author, version, about)] struct Arguments { + #[command(subcommand)] + command: Commands, +} + +#[derive(Debug, Clone, PartialEq, Subcommand)] +enum Commands { /// Show packages flagged out-of-date. - #[clap(short, value_parser)] - flagged: bool, + Flagged, } #[tokio::main] async fn main() -> anyhow::Result<()> { let args = Arguments::parse(); - let filter = if args.flagged { + let filter = if args.command == Commands::Flagged { flagged_filter } else { |_: &raur::Package| true