From 5fbe71c1632a36fc6195f4b0c769157e4d92d00b Mon Sep 17 00:00:00 2001 From: Daniel Valenzuela Date: Sun, 15 Aug 2021 19:10:39 -0400 Subject: [PATCH] =?UTF-8?q?=F0=9F=9A=A9=200.1.2:=20Readme=20updated=20and?= =?UTF-8?q?=207z,=20rar=20support?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 35 +++++++++++++++++++++++++++++++--- config/default.toml | 14 ++++++++++++++ pyproject.toml | 7 +++++-- target-formats/archiving.csv | 4 ++-- target-formats/both.csv | 2 +- target-formats/compression.csv | 8 ++++---- 6 files changed, 58 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index ad88e42..6fa3a43 100644 --- a/README.md +++ b/README.md @@ -39,12 +39,41 @@ export TZAR_CONFIG=$PWD/config ## Configuration -TODO +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: + +``` toml +[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 `` in the `extract` and `list` subcommands, and to `` in the `compress` subcommand +-`directory`: The target directory. Corresponds to `` in the `extract` and `list` subcommands, and to `` in the `compress` subcommand + ## TODO -- [ ] Add a ton of new file formats -- [ ] Document config file +- [-] 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.) diff --git a/config/default.toml b/config/default.toml index a64fc39..498c334 100644 --- a/config/default.toml +++ b/config/default.toml @@ -11,3 +11,17 @@ compress = "zip -r${verbose} ${filename} ${directory}" show = "unzip -l${verbose} ${filename}" extensions = [".zip"] verbose = "v" + +[7z] +extract = "7z x${verbose} ${filename} -o${directory}" +compress = "7z a${verbose} ${filename} ${directory}" +show = "7z l${verbose} ${filename}" +extensions = [".7z"] +verbose = "" + +[rar] +extract = "unrar x${verbose} ${filename} ${directory}" +compress = "rar a${verbose} ${filename} ${directory}" +show = "unrar l${verbose} ${filename}" +extensions = [".rar"] +verbose = "v" diff --git a/pyproject.toml b/pyproject.toml index ce0aae8..192d89f 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,8 +1,11 @@ [tool.poetry] name = "tzar" -version = "0.1.1" -description = "" +version = "0.1.2" +description = "Manage: Tar, Zip, Anything Really!" authors = ["Daniel Valenzuela "] +readme = "README.md" +repository = "https://github.com/DanielVZ96/tzar" +keywords = ["compress", "extract", "tar", "zip"] [tool.poetry.dependencies] python = "^3.7" diff --git a/target-formats/archiving.csv b/target-formats/archiving.csv index 80b980d..414fd26 100644 --- a/target-formats/archiving.csv +++ b/target-formats/archiving.csv @@ -1,4 +1,4 @@ -File extension(s)[1] ,Official name[3] +File extension(s)[1] ,Official name[3], done ".a, .ar ",Unix Archiver .cpio ,cpio .shar ,Shell archive @@ -7,4 +7,4 @@ File extension(s)[1] ,Official name[3] .lbr , .mar ,Mozilla ARchive .sbx ,SeqBox -.tar ,Tape archive +.tar ,Tape archive , x diff --git a/target-formats/both.csv b/target-formats/both.csv index 033dde6..e8c2300 100644 --- a/target-formats/both.csv +++ b/target-formats/both.csv @@ -1,5 +1,5 @@ File extension(s)[1] ,Official name[3] -.7z ,7z +.7z ,7z , x .s7z ,7zX .ace ,ACE .afa ,AFA diff --git a/target-formats/compression.csv b/target-formats/compression.csv index a7e7ec0..a33e67f 100644 --- a/target-formats/compression.csv +++ b/target-formats/compression.csv @@ -1,7 +1,7 @@ File extension(s)[1] ,Official name[3] -.bz2 ,bzip2 -".F, .?XF[5] ",Freeze/melt [1] -.gz ,gzip +.bz2 ,bzip2 , x +".F, .?XF[5] ",Freeze/melt [1] , +.gz ,gzip , x .lz ,lzip .lz4 ,LZ4 .lzma ,lzma @@ -11,7 +11,7 @@ File extension(s)[1] ,Official name[3] .sz ,Snappy .?Q? ,SQ .?Z? ,CRUNCH -.xz ,xz +.xz ,xz ,x .z ,pack .Z ,compress .zst ,Zstandard