meowy-webring/cli/src/arguments.rs

31 lines
805 B
Rust

use clap::{Parser, command, Subcommand, arg, Args};
#[derive(Parser, Debug)]
#[command(author, version, about, long_about = None)]
pub(crate) struct Arguments {
#[command(subcommand)]
pub(crate) command: Commands
}
#[derive(Subcommand, Debug)]
pub(crate) enum Commands {
#[command(about = "print the current webring sites and their names")]
Print {
#[arg(help = "the path to the names.json file")]
path: String,
#[command(flatten)]
group: Group
}
}
#[derive(Args, Debug)]
#[group(required = false)]
pub struct Group {
#[arg(long, short, action = clap::ArgAction::SetTrue, conflicts_with = "name", help = "print the url only")]
pub(crate) url: bool,
#[arg(long, short, action = clap::ArgAction::SetTrue, conflicts_with = "url", help = "print the name only")]
pub(crate) name: bool
}