change output flag to dir flag

This commit is contained in:
khubo 2021-10-20 08:38:06 +05:30
parent 13aad5db87
commit d9196f997f
3 changed files with 7 additions and 7 deletions

View File

@ -34,11 +34,11 @@ ouch decompress a.zip b.tar.gz c.tar
ouch d a.zip
```
You can redirect the decompression results to another folder with the `-o/--output` flag.
You can redirect the decompression results to another folder with the `-d/--dir` flag.
```sh
# Decompress 'summer_vacation.zip' inside of new folder 'pictures'
ouch decompress summer_vacation.zip -o pictures
ouch decompress summer_vacation.zip -d pictures
```
### Compressing

View File

@ -124,7 +124,7 @@ pub fn parse_args_from(mut args: Vec<OsString>) -> crate::Result<ParsedArgs> {
ParsedArgs { command, flags }
}
Some(&"d") | Some(&"decompress") => {
flags_info.push(arg_flag!('o', "output"));
flags_info.push(arg_flag!('d', "dir"));
if let Some(first_arg) = args.first() {
if is_typo(first_arg) {
@ -138,7 +138,7 @@ pub fn parse_args_from(mut args: Vec<OsString>) -> crate::Result<ParsedArgs> {
let (files, flags) = oof::filter_flags(args, &flags_info)?;
let files = files.into_iter().map(PathBuf::from).collect();
let output_folder = flags.arg("output").map(PathBuf::from);
let output_folder = flags.arg("dir").map(PathBuf::from);
// TODO: ensure all files are decompressible
@ -203,10 +203,10 @@ mod tests {
assert_eq!(test_cli("--version").unwrap().flags, oof::Flags::default());
assert_eq!(
test_cli("decompress foo --yes bar --output folder").unwrap().flags,
test_cli("decompress foo --yes bar --dir folder").unwrap().flags,
oof::Flags {
boolean_flags: vec!["yes"].into_iter().collect(),
argument_flags: vec![("output", OsString::from("folder"))].into_iter().collect(),
argument_flags: vec![("dir", OsString::from("folder"))].into_iter().collect(),
}
);
}

View File

@ -48,7 +48,7 @@ fn help_command() {
{yellow}--version{reset} Display version information.
{cyan}SPECIFIC FLAGS:{reset}
{yellow}-o{reset}, {yellow}--output{reset} FOLDER_PATH When decompressing, to decompress files to
{yellow}-d{reset}, {yellow}--dir{reset} FOLDER_PATH When decompressing, to decompress files to
another folder.
Visit https://github.com/ouch-org/ouch for more usage examples.",