docs(universalarchive): expand documentation (#13136)

master
Hanashiko 1 year ago committed by GitHub
parent 1ed17ac052
commit d39804a5a6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 94
      plugins/universalarchive/README.md

@ -1,46 +1,76 @@
# universalarchive plugin # universalarchive plugin
Lets you compress files by a command `ua <format> <files>`, supporting various The `universalarchive` plugin provides a convenient command-line interface for archiving files and directories using a wide variety of compression formats - without having to remember the exact syntax for each tool.
compression formats (e.g. 7z, tar.gz, lzma, ...).
To enable it, add `universalarchive` to the plugins array in your zshrc file: To enable it, add `universalarchive` to the plugins array in your `.zshrc` file:
```zsh ```zsh
plugins=(... universalarchive) plugins=(... universalarchive)
``` ```
## Features
- Compress files and directories using a simple, unified command: ua <format> <files>
- Automatically detects file/directory names to generate appropriate output names
- Supports fallback naming if an output file already exists
- Works with many common and advanced compression formats
- Designed for simplicity and quick use in the terminal
## Usage ## Usage
Run `ua <format> <files>` to compress `<files>` into an archive file using `<format>`. Basic command format:
For example: ```sh
ua <format> <files...>
```
- `<format>`: the archive format to use (e.g., `zip`, `tar.gz`, `xz`, `7z`, etc.)
- `<files...>`: one or more files or directories to compress
## Examples:
Compresses `notes.txt` and `images` into `notes.zip`
```sh
ua zip notes.txt images/
```
Creates `myproject.tar.gz`
```sh
ua tar.gz myproject/
```
Compresses all .log files into `current_folder.xz`
```sh ```sh
ua xz *.html ua xz *.log
``` ```
this command will compress all `.html` files in directory `folder` into `folder.xz`. The plugin will generate a default archive filename based on the input:
- For a file, the output is derived from the file name without its extension.
This plugin saves you from having to remember which command line arguments compress a file. - For a directory, it uses the directory name.
- For multiple files, it uses the name of the common parent directory.
## Supported compression formats
If the output file already exists, a unique filename is generated using `mktemp`.
| Extension | Description |
|:-----------------|:-------------------------------| ## Supported Archive Formats
| `7z` | 7zip file |
| `bz2` | Bzip2 file | | Format | Description | Tool Used |
| `gz` | Gzip file | |:-----------------|:-------------------------------|:-----------------|
| `lzma` | LZMA archive | | `7z` | 7zip archive | `7z` |
| `lzo` | LZO archive | | `bz2` | Bzip2-compressed file | `bzip2` |
| `rar` | WinRAR archive | | `gz` | Gzip-compressed file | `gzip` |
| `tar` | Tarball | | `lzma` | LZMA-compressed file | `lzma` |
| `tbz`/`tar.bz2` | Tarball with bzip2 compression | | `lzo` | LZO-compressed file | `lzop` |
| `tgz`/`tar.gz` | Tarball with gzip compression | | `rar` | WinRAR archive | `rar` |
| `tlz`/`tar.lzma` | Tarball with lzma compression | | `tar` | Uncompressed tarball | `tar` |
| `txz`/`tar.xz` | Tarball with lzma2 compression | | `tbz`,`tar.bz2` | Tarball compressed with Bzip2 | `tar + bzip2` |
| `tZ`/`tar.Z` | Tarball with LZW compression | | `tgz`,`tar.gz` | Tarball compressed with Gzip | `tar + gzip` |
| `xz` | LZMA2 archive | | `tlz`,`tar.lzma` | Tarball compressed with LZMA | `tar + lzma` |
| `Z` | Z archive (LZW) | | `txz`,`tar.xz` | Tarball compressed with LZMA2 | `tar + xz` |
| `zip` | Zip archive | | `tZ`,`tar.Z` | Tarball compressed with LZW | `tar + compress` |
| `zst` | Zstd archive | | `xz` | XZ-compressed file | `xz` |
| `Z` | LZW-compressed file | `compress` |
See [list of archive formats](https://en.wikipedia.org/wiki/List_of_archive_formats) for more information regarding the archive formats. | `zip` | Standard Zip archive | `zip` |
| `zst` | Zstandard-compressed file | `zstd` |
> Note: Some formats may require specific tools to be installed on your system (e.g. `7z`, `rar`, `lzop`, `zstd`). Make sure these tools are available in your `$PATH`.
## Auto-Completion
The plugin provides tab-completion for supported formats and input files. Type `ua <TAB>` to see available formats, and `ua <format> <TAB>` to browse files.

Loading…
Cancel
Save