diff --git a/src/main.rs b/src/main.rs index d3c1563c29c7ec7199b7de8aa154112b16382609..45a552c60be3f22fc562cd6d0d8f3170955aa7bc 100644 --- a/src/main.rs +++ b/src/main.rs @@ -6,6 +6,7 @@ mod create_hooks; mod diff; mod init; mod list; +mod mount; #[derive(Debug, Parser)] #[clap(name = "gbl")] @@ -51,6 +52,10 @@ enum Commands { DeleteHooks, /// Show differences between two commits of the `results` folder Diff(Diff), + /// Mount an old file/directory from one or multiple commits into the .mount folder inside de project directory. + Mount(Mount), + /// Unmount everything in the folder .mount + Umount, } #[derive(Debug, Args)] @@ -136,6 +141,24 @@ struct Diff { commit2: Option<String>, } +#[derive(Debug, Args)] +struct Mount { + /// Commit name, sh: Glob is supported. + /// This is an optional parameter: if not set then all commits will be displayed + #[clap(short, long)] + commit: Option<String>, + /// The file/directory to extract + /// This is an optional parameter. If not set then all files in the archive will be displayed + #[clap(short, long)] + path: Option<String>, + /// If set, displays the .mount directory in 'version view'. + /// + /// - Normal view: The mount directory contains a subfolder with the name of archives + /// - Version view: The mount directory contains the results folder and every file within it becomes a directory storing every version of that file + #[clap(short, long)] + versions: bool, +} + fn main() { let args = Cli::parse(); @@ -173,5 +196,11 @@ fn main() { Commands::DeleteHooks => { create_hooks::delete_hooks(); } + Commands::Mount(mount) => { + mount::mount_archive(&mount.commit, &mount.path, mount.versions); + } + Commands::Umount => { + mount::umount_archive(); + } } }