diff --git a/src/main.rs b/src/main.rs index 72b32b46ca046dfeab8de00ff642a44183d57ade..23b347c339ca1f881086bc1b7e85f4356948c984 100644 --- a/src/main.rs +++ b/src/main.rs @@ -7,6 +7,7 @@ use configt::PartialPrune; mod checkout; mod commit; mod compact; +mod config_structure; mod configt; mod create_hooks; mod delete; @@ -15,7 +16,7 @@ mod init; mod list; mod mount; mod prune; -mod config_structure; +mod remote; #[derive(Debug, Parser)] #[clap(name = "gblk")] @@ -96,6 +97,9 @@ enum Commands { /// time interval without typing always the same prune command #[clap(subcommand)] Config(Config), + /// This command can be used to add a new remote for push and pull commands + #[clap(subcommand)] + Remote(Remote), } #[derive(Debug, Args)] @@ -230,11 +234,11 @@ enum Config { #[derive(Debug, Args)] struct Add { - /// The name of the argument to add, see optional arguments of the prune subcommands + /// The name of the option to add, see optional arguments of the prune subcommands key: String, - /// The value of the argument to add in the configuration file + /// The value of the option to add in the configuration file value: String, - /// Use this flag if you wan to add an argument in the global gblk + /// Use this flag if you wan to add an option in the global gblk /// configuration file #[clap(short, long, takes_value = false)] global: bool, @@ -242,18 +246,49 @@ struct Add { #[derive(Debug, Args)] struct Rm { - /// The name of the argument to remove, see optional arguments of the prune subcommands + /// The name of the option to remove, see optional arguments of the prune subcommands key: String, - /// Use this flag if you wan to remove an argument in the global gblk + /// Use this flag if you want to remove an argument in the global gblk /// configuration file #[clap(short, long, takes_value = false)] global: bool, } - #[derive(Debug, Args)] struct Show { - /// Use this flag if you wan to remove an argument in the global gblk + /// Use this flag if you want to show an argument in the global gblk + /// configuration file + #[clap(short, long, takes_value = false)] + global: bool, +} + +#[derive(Debug, Subcommand)] +enum Remote { + /// Add or update a remote in the configuration file + Add(RemoteAdd), + /// Display globally and locally defined remotes + Show, + /// Remove the configuration of a given key in prune + Rm(RemoteRm), +} + +#[derive(Debug, Args)] +struct RemoteAdd { + /// The name of the remote to add + key: String, + /// The path where the remote is pointing + value: String, + /// Use this flag if you wan to add a remote in the global gblk + /// configuration file + #[clap(short, long, takes_value = false)] + global: bool, +} + +#[derive(Debug, Args)] +struct RemoteRm { + /// The name of the remote to remove + key: String, + /// Use this flag if you want to remove the remote in the global gblk /// configuration file #[clap(short, long, takes_value = false)] global: bool, @@ -332,5 +367,12 @@ fn main() { Config::Rm(e) => configt::remove_config(&e.key, e.global), Config::Prune(pp) => configt::launch_config_prune(pp), }, + Commands::Remote(remote) => match remote { + Remote::Add(e) => println!("Not defined"), + Remote::Show => { + remote::show(); + } + Remote::Rm(e) => println!("Not defined"), + }, } }