red-balloon-89377
11/12/2018, 8:05 PMwitty-crayon-22786
11/12/2018, 8:41 PMwitty-crayon-22786
11/12/2018, 8:41 PMred-balloon-89377
11/12/2018, 8:43 PMwide-energy-11069
11/13/2018, 7:47 PMlet untar_opts = &App::new("tar_api")
.subcommand(
SubCommand::with_name("untar")
).get_matches();
let tar_file = untar_opts
.value_of("file")
.map(PathBuf::from)
.unwrap();
let dest = untar_opts
.value_of("dest")
.map(PathBuf::from)
.unwrap();
wide-energy-11069
11/13/2018, 7:48 PM$ cargo run --bin tar-cli untar --file=/Users/yic/.cache/pants/buildcache/435112070d95ee9e68888acaa47cc019e37477e2/wilyns.thrift.src.main.thrift.thrift-scala/eca0524003263ae610f3d8d9d61ffdd834845a26-JavaThriftLibraryFingerprintStrategy.0c5015cdf521_f8a312d9d0c3.tgz --dest /tmp/x
Finished dev [unoptimized + debuginfo] target(s) in 0.85s
Running `/Users/yic/workspace/pants/src/rust/engine/target/debug/tar-cli untar --file=/Users/yic/.cache/pants/buildcache/435112070d95ee9e68888acaa47cc019e37477e2/wilyns.thrift.src.main.thrift.thrift-scala/eca0524003263ae610f3d8d9d61ffdd834845a26-JavaThriftLibraryFingerprintStrategy.0c5015cdf521_f8a312d9d0c3.tgz --dest /tmp/x`
error: Found argument '--file' which wasn't expected, or isn't valid in this context
wide-energy-11069
11/13/2018, 7:48 PMwide-energy-11069
11/13/2018, 8:04 PMlet untar_opts = &App::new("tar_api")
.subcommand(
SubCommand::with_name("untar")
.arg(Arg::with_name("file").required(true).takes_value(
true,
))
.arg(Arg::with_name("dest").required(true).takes_value(
true,
))
).get_matches();
seems betterwide-energy-11069
11/13/2018, 8:04 PMuntar_opts
.value_of("file")
gives Nonewitty-crayon-22786
11/13/2018, 8:34 PMwitty-crayon-22786
11/13/2018, 8:35 PMwide-energy-11069
11/13/2018, 8:35 PMwide-energy-11069
11/13/2018, 8:36 PMwitty-crayon-22786
11/13/2018, 8:36 PMwide-energy-11069
11/13/2018, 11:07 PMwitty-crayon-22786
11/13/2018, 11:19 PMwitty-crayon-22786
11/13/2018, 11:20 PMwitty-crayon-22786
11/13/2018, 11:22 PMwide-energy-11069
11/13/2018, 11:24 PMwitty-crayon-22786
11/13/2018, 11:27 PMwitty-crayon-22786
11/13/2018, 11:28 PMPathGlobs
as your interface here.witty-crayon-22786
11/13/2018, 11:29 PMwitty-crayon-22786
11/13/2018, 11:29 PMwide-energy-11069
11/13/2018, 11:31 PMwide-energy-11069
11/13/2018, 11:31 PMPathGlobs
?witty-crayon-22786
11/13/2018, 11:31 PMwitty-crayon-22786
11/13/2018, 11:32 PMwide-energy-11069
11/13/2018, 11:32 PMwitty-crayon-22786
11/13/2018, 11:32 PMwide-energy-11069
11/13/2018, 11:48 PMpub fn compress() -> Result<(), std::io::Error> {
let tar_gz = File::create("archive.tar.gz")?;
let enc = GzEncoder::new(tar_gz, Compression::default());
let mut tar = tar::Builder::new(enc);
let mut f = File::open("/tmp/good/gen/scrooge/297e53822ddf/wilyns.thrift.src.main.thrift.thrift-scala/c8959dfdc97a/com/twitter/wilyns/thriftscala/LookupRequest.scala").unwrap();
tar.append_file("gen/scrooge/297e53822ddf/wilyns.thrift.src.main.thrift.thrift-scala/c8959dfdc97a/com/twitter/wilyns/thriftscala/LookupRequest.scala",
&mut f)?;
Ok(())
}
generates archive.tar.gz"
. Then tar -xvf archive.tar.gz
produces the correct LookupRequest.scala
, whereas using rust to untar it giving LookupRequest.scala
as a directory.