gitignore_template_generator/
config.rs

1use clap::Parser;
2
3use crate::validator::{CliArgsValidator, DefaultCliArgsValidator};
4
5#[derive(Parser, Debug)]
6#[command(version, author, long_about = None)]
7#[command(about = "Generate templates for .gitignore files")]
8#[command(help_template = "\
9{before-help}
10{usage-heading} {usage}
11
12{about-with-newline}
13{all-args}{after-help}
14
15Version: {version}
16Author: {author}
17")]
18pub struct Args {
19    #[arg(
20        required_unless_present = "author",
21        value_parser = DefaultCliArgsValidator::has_no_commas,
22        help = "A non-empty list of existing gitignore template names"
23    )]
24    pub template_names: Vec<String>,
25
26    #[arg(
27        id = "author",
28        short = 'a',
29        long = "author",
30        action = clap::ArgAction::SetTrue,
31        help = "Print author"
32    )]
33    pub show_author: bool,
34
35    #[arg(
36        short = 's',
37        long = "server-url",
38        help = "The url to the server hosting gitignore template generator service",
39        default_value = "https://www.toptal.com"
40    )]
41    pub server_url: String,
42}