c the automagic de(c)ompressor

Overview

de(c)ompressor

the de(c)ompressor operates on streams compression streams automagically. input streams are detected by magic numbers, output streams are determined by cli flags (or decompress to plain text if none given).

supported compression formats

  • plain text
  • brotli
  • deflate
  • gzip
  • xz
  • zlib
  • zstd

example usage

$ echo "this is a test" | gzip | c
# this is a test
$ echo "this is a test" | gzip | c -o brotli | brotli -c -d
# this is a test
# brotli cannot be autodetected, so hint it
$ echo "this is a test" | brotli -c | c brotli
# this is a test
# without hint: `�%R�B�[d��`

help

git:(mistress) | ▶  c --help
Usage: c [OPTIONS] [HINT]

Arguments:
  [HINT]  Hint for the compression type, e.g. `brotli` [default: unknown]

Options:
  -q, --quiet
  -o, --output-type <OUTPUT_TYPE>  Force the output to be compressed with the given type, e.g. `brotli` [default: none] [possible values: zstd, brotli, gzip, deflate, zlib, xz, none]
  -h, --help                       Print help
git:(mistress) |

de(c)ompressor must be run via stdin/out pipes, otherwise it will fail:

git:(mistress) 7 | ▶  c
Error:
   0: input is a terminal, please pipe data via stdin!

Location:
   src/main.rs:36

Backtrace omitted. Run with RUST_BACKTRACE=1 environment variable to display it.
Run with RUST_BACKTRACE=full to include source snippets.
git:(mistress) |
You might also like...
Comments
  • Bump clap from 4.1.3 to 4.1.4

    Bump clap from 4.1.3 to 4.1.4

    Bumps clap from 4.1.3 to 4.1.4.

    Release notes

    Sourced from clap's releases.

    v4.1.4

    [4.1.4] - 2023-01-24

    Fixes

    • (help) Respect disable_colored_help when using arg_required_else_help

    Performance

    • Speed up compiling arg! macro
    Changelog

    Sourced from clap's changelog.

    [4.1.4] - 2023-01-24

    Fixes

    • (help) Respect disable_colored_help when using arg_required_else_help

    Performance

    • Speed up compiling arg! macro
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
  • Bump clap from 4.1.1 to 4.1.3

    Bump clap from 4.1.1 to 4.1.3

    Bumps clap from 4.1.1 to 4.1.3.

    Release notes

    Sourced from clap's releases.

    v4.1.3

    [4.1.3] - 2023-01-23

    Fixes

    • (error) Improve suggested flag/value/subcommand when two share a long preifx
    • (error) When suggesting one of several subcommands, use the plural subcommands, rather than subcommand

    v4.1.2

    [4.1.2] - 2023-01-23

    Fixes

    • In documentation, refer to get_flag, rather than get_one::<bool>
    Changelog

    Sourced from clap's changelog.

    [4.1.3] - 2023-01-23

    Fixes

    • (error) Improve suggested flag/value/subcommand when two share a long preifx
    • (error) When suggesting one of several subcommands, use the plural subcommands, rather than subcommand

    [4.1.2] - 2023-01-23

    Fixes

    • In documentation, refer to get_flag, rather than get_one::<bool>
    Commits

    Dependabot compatibility score

    Dependabot will resolve any conflicts with this PR as long as you don't alter it yourself. You can also trigger a rebase manually by commenting @dependabot rebase.


    Dependabot commands and options

    You can trigger Dependabot actions by commenting on this PR:

    • @dependabot rebase will rebase this PR
    • @dependabot recreate will recreate this PR, overwriting any edits that have been made to it
    • @dependabot merge will merge this PR after your CI passes on it
    • @dependabot squash and merge will squash and merge this PR after your CI passes on it
    • @dependabot cancel merge will cancel a previously requested merge and block automerging
    • @dependabot reopen will reopen this PR if it is closed
    • @dependabot close will close this PR and stop Dependabot recreating it. You can achieve the same result by closing it manually
    • @dependabot ignore this major version will close this PR and stop Dependabot creating any more for this major version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this minor version will close this PR and stop Dependabot creating any more for this minor version (unless you reopen the PR or upgrade to it yourself)
    • @dependabot ignore this dependency will close this PR and stop Dependabot creating any more for this dependency (unless you reopen the PR or upgrade to it yourself)
    dependencies 
    opened by dependabot[bot] 0
Owner
amy
i write software. when i'm lucky, it works! it/its / she/her. platform team lead @massdriver-cloud
amy