Commit Graph

10 Commits

Author SHA1 Message Date
Eric Nielsen 2e3ba7996b
[archive] Allow archives in any directory
Current code will create an archive in the current directory with:

    % archive ../test.tar.gz test.*

or will complain that the following archive doesn't exist in the current
directory (given it actually exists in the parent one):

    % unarchive ../test.tar.gz

Fix that and allow archives in any directory.

Other changes:

* Use `<required_param>` instead of `[required_param]` in the usage text
* Don't explictly check if archive exists in `unarchive`, but let the
  respective tool fail with its own message

Closes #312
2018-11-24 22:45:08 -05:00
Eric Nielsen 1c23ea1604 [archive] Support archive of multiple files
not just one directory.

Also use shorter versions of the `tar` parameters, since we were using a
mixture of the short and long ones among `archive` and `unarchive`.

About not using `$` inside `(( ))`, this is what the the section
ARITHMETIC EVALUATION in zshmisc(1) says:

> Named parameters and subscripted arrays can be referenced by name
> within an arithmetic expression without using the parameter expansion
> syntax.

And according to http://www.bash2zsh.com/zsh_refcard/refcard.pdf:

> `var` (does not require `$` in front unless some substitution e.g.
> `${#var}` is needed, `$` is error if `var` is to be modified)

Closes #308
2018-11-14 20:32:37 -05:00
Eric Nielsen 2c5e7c02ea [archive] Add missing bzip2 extensions
We already had .tar.bz2, .tbz, .tbz2 and .bz2
We were missing .tar.bz and .bz

Noticed this in the pull request #308 by @Konfekt.
2018-11-14 20:20:52 -05:00
Eric Nielsen 6af7892f91 [archive] Check unrar with commands array
“unrar-free returns the error code 1 when run without arguments, thus
failing the presence check.” as reported at sorin-ionescu/prezto#1383

Reformat code and use one-liners instead of if/then/fi. And we don’t
need to separate local definitions from assignments anymore starting
from zsh 5.2.
2018-02-07 18:27:59 -05:00
Eric Nielsen b190231682 [archive] Remove _gzip_bin and _bzip2_bin refs
as these variables are not being set anymore.

Fixes #220
2017-10-23 09:54:08 -05:00
Matt Hamilton 8fbd143b01 set defaults for bz2 and gz compression utils
Fix #220
2017-10-08 16:38:38 -04:00
Matt Hamilton 89b2986db9 cleanup function error messages 2016-01-07 15:36:31 -05:00
Matt Hamilton fd826dbd8a fixup pigz and pbzip2 in (un)archive funcs 2015-12-19 17:08:43 -05:00
Matt Hamilton a1a56ac63f use consistent variable style 2015-12-19 09:48:29 -05:00
Matt Hamilton ceb0f3ad2a add archive module 2015-12-16 17:00:25 -05:00