Skip to content
Snippets Groups Projects
Commit 3d17978f authored by nfontrod's avatar nfontrod
Browse files

src/main.rs: usage of init_and_hook function to create the borg repository

parent f542474a
No related branches found
No related tags found
No related merge requests found
......@@ -19,7 +19,7 @@ struct Cli {
#[derive(Debug, Subcommand)]
enum Commands {
/// Initialize a borg repository inside a git project
Init,
Init(Init),
/// Save the results folder of a git repository in an archive
///
/// The archive will be named as the current commit in git
......@@ -48,6 +48,16 @@ enum Commands {
CreateHooks(CreateHooks),
}
#[derive(Debug, Args)]
struct Init {
/// If specified, hooks are created inside `.git/hooks repository`
#[clap(takes_value = false, short, long)]
hooks: bool,
/// The compression to use automatically at each commit if hooks are created
#[clap(short, long, default_value = "lz4")]
compression: String,
}
#[derive(Debug, Args)]
struct Commit {
/// The compression used to save the results folder (no, lz4, zstd, zlib or lzma)
......@@ -93,8 +103,8 @@ fn main() {
let args = Cli::parse();
match args.commands {
Commands::Init => {
init::init_repository();
Commands::Init(init) => {
init::init_and_hook(init.hooks, &init.compression);
}
Commands::Commit(commit) => {
commit::commit(commit.compression, String::from(""), commit.update);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment