Manage: Tar, Zip, Anything Really!
Project description
Tzar: Tar, Zip, Anything Really
Easy compression and extraction for any compression or archival format.
Usage/Examples
tzar compress large-dir compressed.tar.gz
tzar extract compressed.tar.gz large-dir
tzar list compressed.tar.gz
It's always tzar <command> <source> [<destination>]
Installation
The package is published in PyPi under tzar
. You can install it with the following methods
Pipx (recommended)
pipx install tzar
Pip
pip3 install tzar
Dev
git clone git@github.com:DanielVZ96/tzar
cd tzar
poetry install
export TZAR_CONFIG=$PWD/config
Configuration
Configuration is read from the standard directories for each OS (~/.config/tzar/*.toml). You can add any number of toml files to that directory and they will all be read by tzar at runtime.
The configuration file has the following format:
[command or format]
extract = "command extract ${verbose} ${filename} ${directory}"
compress = "command compress ${verbose} ${directory} ${filename}"
show = "command list ${verbose} ${filename}"
extensions = [".ext1",".ext2"]
verbose = "-v"
[another command or format]
extract = "another x${verbose} ${filename} ${directory}"
compress = "another c${verbose} ${directory} ${filename}"
show = "another list ${verbose} ${filename}"
extensions = [".anoth"]
verbose = "v"
All commands should have the extract
, compress
, show
, extensions
and verbose
values defined.
They are all self explanatory; they define templates for the commands to run, the extensions
for these commands, and how you can ask for a verbose output.
They can all contain the following template variables that will be replaced at runtime:
-verbose
: Defines how and where to ask for a verbose output (defined in the verbose =
variable definition).
-filename
: The name of the compressed file. Corresponds to <source>
in the extract
and list
subcommands, and to <destination>
in the compress
subcommand
-directory
: The target directory. Corresponds to <destination>
in the extract
and list
subcommands, and to <source>
in the compress
subcommand
Why?
- Because I think it's simpler
You may think that this should be doable with aliases, but I tried and I couldn't. Maybe you can use the fuck
app
or tldr
but I still feel it could be simpler to extract files (wtf does xvzf even mean?).
- Because I wanted to try the idea of Code as Configuration
Maybe this sounds crazy, but I started this project by exploring the idea of storing the main behaviour of code in configuration files (in this case TOML), in order to ease extensibility, reduce posible errors, and keep things simple. In my dayjob we tried this idea with my colleagues and the result is that changes that previously spawned several files or lines of code, are now reduced into 2 or 3 hard-to-fuck-up yaml lines. If this project gains traction I may write a blog post about this.
TODO
- [-] Add a ton of new file formats
- Document code
- Interactive prompt
- Tests (Don't judge, I'm coding this in the spare time I have during my lunch breaks.)
Authors
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file tzar-0.1.5.tar.gz
.
File metadata
- Download URL: tzar-0.1.5.tar.gz
- Upload date:
- Size: 5.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.7.9 Linux/5.11.0-7614-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | f8074bb8574817e3f641d1cb459b85b9e8ad1690ca79287370639fc72ba8d0b3 |
|
MD5 | 726fbe650058615fbc74113049393f59 |
|
BLAKE2b-256 | a9839e092aaab15bbb51decaad867f79efd712b9bab4912621efccf762c43f3c |
File details
Details for the file tzar-0.1.5-py3-none-any.whl
.
File metadata
- Download URL: tzar-0.1.5-py3-none-any.whl
- Upload date:
- Size: 6.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.1.5 CPython/3.7.9 Linux/5.11.0-7614-generic
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 5e30b9172bad1069c23cb171cddb5156c5f4ad627acf8ee0d3bb12e5f2e78dfa |
|
MD5 | 05e11bfda0f217e21b6286951faae2fc |
|
BLAKE2b-256 | b44183d200e42816a6b28ab999d78a1dd0caf86064b8cee615064fb7f6a314c9 |