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
No related branches found
No related tags found
No related merge requests found
......@@ -52,7 +52,8 @@ 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 an old file/directory from one or multiple archive named afert
/// git commits into the .mount folder inside de project directory.
Mount(Mount),
/// Unmount everything in the folder .mount
Umount,
......@@ -143,20 +144,36 @@ struct Diff {
#[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
/// Commit name, sh: Glob is supported. This is an optional parameter: if
/// not set then all commit archives will be mounted into the .mount directory
#[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
/// 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
/// - 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,
/// 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() {
......@@ -201,7 +218,13 @@ fn main() {
}
Commands::Mount(mount) => {
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 => {
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