Add git version subcommand for rcore-fs-fuse

master
Jiajie Chen 6 years ago
parent 0508538490
commit 585eb6197a

@ -14,6 +14,7 @@ log = "0.4"
fuse = { version = "0.3", optional = true }
structopt = "0.2"
env_logger = "0.3"
git-version = "0.3"
rcore-fs = { path = "../rcore-fs", features = ["std"] }
rcore-fs-sfs = { path = "../rcore-fs-sfs" }
rcore-fs-sefs = { path = "../rcore-fs-sefs", features = ["std"] }

@ -12,6 +12,8 @@ use rcore_fs_fuse::zip::{unzip_dir, zip_dir};
use rcore_fs_sefs as sefs;
use rcore_fs_sfs as sfs;
use git_version::git_version;
#[derive(Debug, StructOpt)]
struct Opt {
/// Command
@ -45,6 +47,9 @@ enum Cmd {
#[cfg(feature = "use_fuse")]
#[structopt(name = "mount")]
Mount,
#[structopt(name = "git-version")]
GitVersion,
}
fn main() {
@ -57,6 +62,10 @@ fn main() {
Cmd::Mount => !opt.image.is_dir() && !opt.image.is_file(),
Cmd::Zip => true,
Cmd::Unzip => false,
Cmd::GitVersion => {
println!("{}", git_version!());
return;
}
};
let fs: Arc<FileSystem> = match opt.fs.as_str() {
@ -99,5 +108,6 @@ fn main() {
std::fs::create_dir(&opt.dir).expect("failed to create dir");
unzip_dir(&opt.dir, fs.root_inode()).expect("failed to unzip fs");
}
Cmd::GitVersion => unreachable!(),
}
}

Loading…
Cancel
Save