diff --git a/src/bin/pxar.rs b/src/bin/pxar.rs index 1ba81d58..ccdf4ab5 100644 --- a/src/bin/pxar.rs +++ b/src/bin/pxar.rs @@ -77,7 +77,7 @@ fn extract_archive( ) -> Result { let archive = tools::required_string_param(¶m, "archive")?; - let target = tools::required_string_param(¶m, "target")?; + let target = param["target"].as_str().unwrap_or("."); let verbose = param["verbose"].as_bool().unwrap_or(false); let no_xattrs = param["no-xattrs"].as_bool().unwrap_or(false); let no_fcaps = param["no-fcaps"].as_bool().unwrap_or(false); @@ -177,13 +177,13 @@ fn main() { extract_archive, ObjectSchema::new("Extract an archive.") .required("archive", StringSchema::new("Archive name.")) - .required("target", StringSchema::new("Target directory.")) + .optional("target", StringSchema::new("Target directory.")) .optional("verbose", BooleanSchema::new("Verbose output.").default(false)) .optional("no-xattrs", BooleanSchema::new("Ignore extended file attributes.").default(false)) .optional("no-fcaps", BooleanSchema::new("Ignore file capabilities.").default(false)) .optional("no-acls", BooleanSchema::new("Ignore access control list entries.").default(false)) )) - .arg_param(vec!["archive", "target"]) + .arg_param(vec!["archive"]) .completion_cb("archive", tools::complete_file_name) .completion_cb("target", tools::complete_file_name) .into() diff --git a/tests/pxar.rs b/tests/pxar.rs index 8e66a4c9..e2f0a211 100644 --- a/tests/pxar.rs +++ b/tests/pxar.rs @@ -27,6 +27,7 @@ fn pxar_create_and_extract() { Command::new(exec_path) .arg("extract") .arg("./tests/archive.pxar") + .arg("--target") .arg(dest_dir) .status() .unwrap_or_else(|err| {