git_clone_canonical/options.rs
1use crate::{BaseDir, Error, Result, Url};
2use clap::Parser;
3
4/// Run git clone into a path derived from the source url
5#[derive(Debug, Parser)]
6#[clap()]
7pub struct Options {
8 /// base directory for git clone
9 #[clap(long, default_value_t)]
10 pub basedir: BaseDir,
11
12 /// show the associated path, performing no other operations
13 #[clap(long, short)]
14 pub show_path: bool,
15
16 /// The git clone url (git-url-like sources are not supported)
17 #[clap()]
18 pub url: Url,
19}
20
21impl Options {
22 pub fn try_parse() -> Result<Self> {
23 <Self as Parser>::try_parse().map_err(Error::from)
24 }
25}