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

src/main.rs: add last and diff option to mount subcommand

parent e88d7623
Branches
No related tags found
No related merge requests found
...@@ -52,7 +52,8 @@ enum Commands { ...@@ -52,7 +52,8 @@ enum Commands {
DeleteHooks, DeleteHooks,
/// Show differences between two commits of the `results` folder /// Show differences between two commits of the `results` folder
Diff(Diff), Diff(Diff),
/// Mount an old file/directory from one or multiple commits into the .mount folder inside de project directory. /// Mount an old file/directory from one or multiple archive named afert
/// git commits into the .mount folder inside de project directory.
Mount(Mount), Mount(Mount),
/// Unmount everything in the folder .mount /// Unmount everything in the folder .mount
Umount, Umount,
...@@ -143,20 +144,36 @@ struct Diff { ...@@ -143,20 +144,36 @@ struct Diff {
#[derive(Debug, Args)] #[derive(Debug, Args)]
struct Mount { struct Mount {
/// Commit name, sh: Glob is supported. /// Commit name, sh: Glob is supported. This is an optional parameter: if
/// This is an optional parameter: if not set then all commits will be displayed /// not set then all commit archives will be mounted into the .mount directory
#[clap(short, long)] #[clap(short, long)]
commit: Option<String>, commit: Option<String>,
/// The file/directory to extract /// The file/directory to extract. This is an optional parameter. If not set
/// This is an optional parameter. If not set then all files in the archive will be displayed /// then all files in the archive will be displayed
#[clap(short, long)] #[clap(short, long)]
path: Option<String>, path: Option<String>,
/// If set, displays the .mount directory in 'version view'. /// If set, displays the .mount directory in 'version view'.
/// ///
/// - Normal view: The mount directory contains a subfolder with the name of archives /// - Normal view: The `.mount` directory contains a subfolder with the name
/// - Version view: The mount directory contains the results folder and every file within it becomes a directory storing every version of that file /// 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)] #[clap(short, long)]
versions: bool, versions: bool,
/// Displays the differences between two files mounted corresponding to the
/// given path.
///
/// Note that if only one file is recovered then, the other is taken from
/// the current result folder
///
/// This option is deactivated when used with --diff
#[clap(short, long)]
diff: bool,
/// Consider last N archive after other filter were applied
#[clap(short, long)]
last: Option<u8>,
} }
fn main() { fn main() {
...@@ -201,7 +218,13 @@ fn main() { ...@@ -201,7 +218,13 @@ fn main() {
} }
Commands::Mount(mount) => { Commands::Mount(mount) => {
mount::umount_archive(true); mount::umount_archive(true);
mount::mount_archive(&mount.commit, &mount.path, mount.versions); mount::mount_archive(
&mount.commit,
&mount.path,
mount.versions,
mount.diff,
mount.last,
);
} }
Commands::Umount => { Commands::Umount => {
mount::umount_archive(false); mount::umount_archive(false);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment