mirror of
https://github.com/ouch-org/ouch.git
synced 2025-06-06 19:45:29 +00:00
Update README.md
This commit is contained in:
parent
0f453e9dfc
commit
3f47d2f6d6
156
README.md
156
README.md
@ -1,133 +1,115 @@
|
|||||||
# ouch (_work in progress_)
|
# Ouch!
|
||||||
|
|
||||||
`ouch` is the Obvious Unified Compression (_and decompression_) Helper.
|
### This readme is a WIP draft, and does not represent the reality
|
||||||
|
See the old README at https://github.com/vrmiguel/ouch/tree/0f453e9dfc70066056b9cc40e8032dcc6ee703bc
|
||||||
|
<!--  -->
|
||||||
|
|
||||||
|
`ouch` loosely stands for Obvious Unified Compression (ᵃⁿᵈ ᵈᵉᶜᵒᵐᵖʳᵉˢˢᶦᵒⁿ) Helper and aims to be an easy and intuitive way of compressing and decompressing files on the command-line.
|
||||||
|
|
||||||
|
- [Usage](#Usage)
|
||||||
|
- [Decompress](#Decompress)
|
||||||
|
- [Compress](#Compress)
|
||||||
|
- [Convert](#Convert)
|
||||||
|
- [Supported Formats](#Supported-formats)
|
||||||
|
- [Installation](#Installation)
|
||||||
|
- [Supported operating systems](#Supported-operating-systems)
|
||||||
|
|
||||||
|
|
||||||
| Supported formats | .tar | .zip | .tar.{.lz*,.gz, .bz} | .zip.{.lz*, .gz, .bz*} | .bz | .gz | .lz, .lzma |
|
## Usage
|
||||||
|-------------------|------|------|------------------------------|------------------------------|-----|-----|------------|
|
|
||||||
| Decompression | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
||||||
| Compression | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ |
|
|
||||||
|
|
||||||
## How does it work?
|
`ouch` uses the file extensions to infer the file formats.
|
||||||
|
|
||||||
`ouch` infers commands from the extensions of its command-line options.
|
For example, `ouch compress a b c.zip` tells to compress `a` and `b` into the same `c.zip` compressed file.
|
||||||
|
|
||||||
```
|
### Decompressing files
|
||||||
ouch 0.1.4
|
<!-- botei caps e mais um #, acho que ficou bom para os comandos -->
|
||||||
Vinícius R. Miguel
|
|
||||||
ouch is a unified compression & decompression utility
|
|
||||||
|
|
||||||
USAGE:
|
To decompress, just call `ouch` passing the input files.
|
||||||
ouch [OPTIONS] --input <input>...
|
|
||||||
|
|
||||||
FLAGS:
|
Use the `-o, --output` flag to redirect the output to a folder.
|
||||||
-h, --help Displays this message and exits
|
|
||||||
-V, --version Prints version information
|
|
||||||
|
|
||||||
OPTIONS:
|
|
||||||
-i, --input <input>... The input files or directories.
|
|
||||||
-o, --output <output> The output directory or compressed file.
|
|
||||||
```
|
|
||||||
|
|
||||||
### Examples
|
|
||||||
|
|
||||||
#### Decompressing a bunch of files
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ouch -i file{1..5}.zip another_file.tar.gz yet_another_file.tar.bz
|
# Decompress `a.zip`
|
||||||
|
ouch a.zip
|
||||||
|
|
||||||
|
# Decompress multiple files
|
||||||
|
ouch a.zip b.tar.gz
|
||||||
|
|
||||||
|
# Decompress multiple files, but inside new_folder
|
||||||
|
ouch a.zip b.tar.gz -o new_folder
|
||||||
```
|
```
|
||||||
|
|
||||||
When no output file is supplied, `ouch` infers that it must decompress all of its input files into the current folder. This will error if any of the input files are not decompressible.
|
### Compressing files and directories
|
||||||
|
|
||||||
#### Decompressing a bunch of files into a folder
|
The `compress` subcommand accepts files and folders where the **last** one is the desired **output file**.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ ouch -i file{1..3}.tar.gz videos.tar.bz2 -o some-folder
|
# Compress four files into `archive.zip`
|
||||||
# Decompresses file1.tar.gz, file2.tar.gz, file3.tar.gz and videos.tar.bz2 to some-folder
|
ouch compress a b c d archive.zip
|
||||||
# The folder `ouch` saves to will be created if it doesn't already exist
|
|
||||||
|
# Compress three files into `.tar.bz2` archive
|
||||||
|
ouch compress a.mp4 b.jpg c.png files.tar.bz2
|
||||||
|
|
||||||
|
# Compress a folder and a file into `videos.tar.xz`
|
||||||
|
ouch compress Videos/ funny_meme.mp4 videos.tar.xz
|
||||||
```
|
```
|
||||||
|
|
||||||
When the output file is not a compressed file, `ouch` will check if all input files are decompressible and infer that it must decompress them into the output folder.
|
### Converting between compressed archives
|
||||||
|
|
||||||
#### Compressing files
|
```
|
||||||
|
# Will decompress a.tar.gz b.tar.bz and compress it into new-archive.tar.xz2
|
||||||
```bash
|
ouch convert a.tar.gz b.tar.bz new-archive.tar.xz2
|
||||||
$ ouch -i file{1..20} -o archive.tar
|
|
||||||
$ ouch -i Videos/ Movies/ -o media.tar.lzma
|
|
||||||
$ ouch -i src/ Cargo.toml Cargo.lock -o my_project.tar.gz
|
|
||||||
```
|
```
|
||||||
|
|
||||||
### Error scenarios
|
### Listing the elements of an archive
|
||||||
|
|
||||||
#### No clear decompression algorithm
|
(TODO -- not implemented at all)
|
||||||
|
|
||||||
```bash
|
```
|
||||||
$ ouch -i some-file -o some-folder
|
# Shows the files contained in videos.tar.xz
|
||||||
error: file 'some-file' is not decompressible.
|
ouch list videos.tar.xz
|
||||||
|
1. .....
|
||||||
```
|
```
|
||||||
|
|
||||||
`ouch` cannot infer `some-file`'s compression format since it lacks an extension. Likewise, `ouch` cannot infer that the output file given is a compressed file, so it shows the user an error.
|
## Supported formats
|
||||||
|
|
||||||
```bash
|
|
||||||
$ ouch -i file other-file -o files.gz
|
| | .tar | .zip | .tar.\*¹ | .zip.\*² | .bz, .bz2 | .gz | .xz, .lz, .lzma | .7z |
|
||||||
error: cannot compress multiple files directly to Gzip.
|
|:-------------:|:----:|:----:|:--------:|:--------:|:---------:| --- |:---------------:| --- |
|
||||||
Try using an intermediate archival method such as Tar.
|
| Decompression | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ |
|
||||||
Example: filename.tar.gz
|
| Compression | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✓ | ✗ |
|
||||||
|
|
||||||
|
```
|
||||||
|
Note: .tar.*¹: .tar.gz, .tar.bz, .tar.bz2, .tar.xz, .tar.lz, .tar.lzma, .tar.zip
|
||||||
|
.zip.*²: .zip.gz, .zip.bz, .zip.bz2, .zip.xz, .zip.lz, .zip.lzma, .zip.zip
|
||||||
```
|
```
|
||||||
|
|
||||||
Similar errors are shown if the same scenario is applied to `.lz/.lzma` and `.bz/.bz2`.
|
|
||||||
|
|
||||||
## Installation
|
## Installation
|
||||||
|
|
||||||
### Runtime dependencies
|
### Getting a pre-compiled binary
|
||||||
|
|
||||||
`ouch` depends on a few widespread libraries:
|
```bash
|
||||||
* libbz2
|
curl -s https://raw.githubusercontent.com/vrmiguel/ouch/master/install.sh | bash
|
||||||
* liblzma
|
```
|
||||||
|
|
||||||
Both should be already installed in any mainstream Linux distribution.
|
### Building
|
||||||
|
|
||||||
If they're not, then:
|
A recent [Rust] toolchain is needed to build `ouch`. Go to [rustup.rs](https://rustup.rs/) to get it.
|
||||||
|
|
||||||
* On Debian-based distros
|
Once [Cargo](https://doc.rust-lang.org/cargo/) is installed, run:
|
||||||
|
|
||||||
`sudo apt install liblzma-dev libbz2-dev`
|
|
||||||
|
|
||||||
* On Arch-based distros
|
|
||||||
|
|
||||||
`sudo pacman -S xz bzip2`
|
|
||||||
|
|
||||||
The last dependency is a recent [Rust](https://www.rust-lang.org/) toolchain. If you don't have one installed, follow the instructions at [rustup.rs](https://rustup.rs/).
|
|
||||||
|
|
||||||
### Build process
|
|
||||||
|
|
||||||
Once the dependency requirements are met:
|
|
||||||
|
|
||||||
* Installing from [Crates.io](https://crates.io)
|
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
cargo install ouch
|
cargo install ouch
|
||||||
```
|
# or
|
||||||
|
|
||||||
* Cloning and building
|
|
||||||
|
|
||||||
```bash
|
|
||||||
git clone https://github.com/vrmiguel/ouch
|
git clone https://github.com/vrmiguel/ouch
|
||||||
cargo install --path ouch
|
cargo install --path ouch
|
||||||
# or
|
|
||||||
cd ouch && cargo run --release
|
|
||||||
```
|
```
|
||||||
|
|
||||||
I also recommend stripping the release binary. `ouch`'s release binary (at the time of writing) only takes up a megabyte in space when stripped.
|
|
||||||
|
|
||||||
## Supported operating systems
|
## Supported operating systems
|
||||||
|
|
||||||
`ouch` _should_ be cross-platform but is currently only tested (and developed) on Linux, on both x64-64 and ARM.
|
|
||||||
|
|
||||||
## Limitations
|
## Limitations
|
||||||
|
|
||||||
`ouch` does encoding and decoding in-memory, so decompressing very large files with `ouch` is not advisable.
|
`ouch` does encoding and decoding in-memory, so decompressing very large files with it is not advisable.
|
||||||
|
|
||||||
## Contributions
|
|
||||||
|
|
||||||
Any contributions and suggestions are welcome!
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user