1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use clap::{Parser, ValueEnum};
#[derive(ValueEnum, Clone, Debug)]
pub enum Part {
Scheme,
Host,
Port,
User,
Password,
Path,
}
#[derive(Parser, Debug)]
#[command(
about,
author,
version,
propagate_version = true,
next_line_help = false,
disable_help_subcommand = true,
after_long_help = "This tool can be used to extract parts of a connection string. It is useful for extracting the database name from a connection string, for example."
)]
pub struct Cli {
pub url: String,
#[arg(short, long, required = true)]
pub part: Part,
}