The Automatic Archive-Extraction Ice-Tool#
Zinit has a swiss-knife tool for unpacking all kinds of archives – the
extract'' ice. It works in two modes – automatic mode and fixed mode.
It is active if the ice is empty (or contains only flags – more on them later). It works as follows:
- At first, a recursive search for files of known file
extensions located not deeper than in
a sub-directory is being performed. All such found files are then extracted.
- The directory-level limit is to skip extraction of some helper archive files, which are typically located somewhere deeper in the directory tree.
- IF no such files will be found, then a recursive search for files of
known archive types will be performed. This is basically done by running
fileUnix command on each file in the plugin or snippet directory and then grepping the output for strings like
bzip2, etc. All such discovered files are then extracted.
- The directory-level requirement is imposed also during this stage - files located deeper in the tree than in a sub-directory are omitted.
- If no archive files will be discovered then no action is being performed and also no warning message is being printed.
It is active when a filename is being passed as the
extract's argument, e.g.:
zinit extract=archive.zip for zdharma-continuum/null. Multiple files can be specified
– separated by spaces. In this mode all and only the specified files are being
Filenames With Spaces#
The filenames with spaces in them are supported by a trick – to correctly pass
such a filename to
extract use the non-breaking space in place of the
in-filename original spaces. The non-breaking space is easy to type by pressing
right Alt and the Space.
The value of the ice can begin with a two special characters:
- Exclamation mark (
extract='!…'– it'll cause the files to be moved one directory-level up upon unpacking,
- Dash (
extract'-…'– it'll prevent removal of the archive after unpacking.
- This flag is useful to allow comparing timestamps with the server in case
of snippet-downloaded file – it will prevent unnecessary downloads during
zinit update, as the timestamp of the archive file on the disk will be first compared with the HTTP last-modification time header.
- This flag is useful to allow comparing timestamps with the server in case of snippet-downloaded file – it will prevent unnecessary downloads during
The flags can be combined in any order, e.g.:
Sometimes a more uncommon unpacking operation is needed. In such case you can
directly use the function that implements the ice – it is called
recognizes the following options:
--auto– runs the automatic extraction.
--move– performs the one-directory-level-up move of the files after unpacking.
--norm- prevents the archive file removal.
- And also one option specific only to the function:
--nobkp, which prevents clearing of the plugin's dir before the extraction – normally all the files except the archive are being moved into
._backupdirectory and after that the extraction is performed.
extractice also skips creating the backup if more than one archive is found or given as the argument.
Supported File Formats#
- OS X dmg images.