Skip to content
Snippets Groups Projects
Verified Commit 06ea340a authored by nfontrod's avatar nfontrod
Browse files

src/main.rs: handle remote module function

parent 01a2cfa9
No related branches found
No related tags found
No related merge requests found
...@@ -7,6 +7,7 @@ use configt::PartialPrune; ...@@ -7,6 +7,7 @@ use configt::PartialPrune;
mod checkout; mod checkout;
mod commit; mod commit;
mod compact; mod compact;
mod config_structure;
mod configt; mod configt;
mod create_hooks; mod create_hooks;
mod delete; mod delete;
...@@ -15,7 +16,7 @@ mod init; ...@@ -15,7 +16,7 @@ mod init;
mod list; mod list;
mod mount; mod mount;
mod prune; mod prune;
mod config_structure; mod remote;
#[derive(Debug, Parser)] #[derive(Debug, Parser)]
#[clap(name = "gblk")] #[clap(name = "gblk")]
...@@ -96,6 +97,9 @@ enum Commands { ...@@ -96,6 +97,9 @@ enum Commands {
/// time interval without typing always the same prune command /// time interval without typing always the same prune command
#[clap(subcommand)] #[clap(subcommand)]
Config(Config), Config(Config),
/// This command can be used to add a new remote for push and pull commands
#[clap(subcommand)]
Remote(Remote),
} }
#[derive(Debug, Args)] #[derive(Debug, Args)]
...@@ -230,11 +234,11 @@ enum Config { ...@@ -230,11 +234,11 @@ enum Config {
#[derive(Debug, Args)] #[derive(Debug, Args)]
struct Add { 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, 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, 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 /// configuration file
#[clap(short, long, takes_value = false)] #[clap(short, long, takes_value = false)]
global: bool, global: bool,
...@@ -242,18 +246,49 @@ struct Add { ...@@ -242,18 +246,49 @@ struct Add {
#[derive(Debug, Args)] #[derive(Debug, Args)]
struct Rm { 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, 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 /// configuration file
#[clap(short, long, takes_value = false)] #[clap(short, long, takes_value = false)]
global: bool, global: bool,
} }
#[derive(Debug, Args)] #[derive(Debug, Args)]
struct Show { 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 /// configuration file
#[clap(short, long, takes_value = false)] #[clap(short, long, takes_value = false)]
global: bool, global: bool,
...@@ -332,5 +367,12 @@ fn main() { ...@@ -332,5 +367,12 @@ fn main() {
Config::Rm(e) => configt::remove_config(&e.key, e.global), Config::Rm(e) => configt::remove_config(&e.key, e.global),
Config::Prune(pp) => configt::launch_config_prune(pp), 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"),
},
} }
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment