From 5a5a20fbaf4c22bfb24b40fce67599ec0d2cd764 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=BA=C5=A1=20Ferech?= Date: Tue, 27 Feb 2024 16:28:20 +0100 Subject: [PATCH] Add CLI section to README --- README.md | 60 +++++++++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 54 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 55f6726..9a360d9 100644 --- a/README.md +++ b/README.md @@ -2,11 +2,21 @@ ![ci](https://github.com/matusf/z-base-32/actions/workflows/ci.yml/badge.svg) -The `z-base-32` is a human oriented base32 encoding. +The `z-base-32` is a human-oriented base-32 encoding. -## API +## Rust -The library exposes two functions with following signatures and error type: +### Crate + +#### Installation + +```sh +cargo add z-base-32 +``` + +#### API + +The library exposes two functions with the following signatures and an error type: ```rs pub fn encode(input: &[u8]) -> String; @@ -16,7 +26,7 @@ pub fn decode(input: &str) -> Result, DecodeError>; pub struct DecodeError; ``` -### Example +#### Example ```rs use zbase32::{encode, decode}; @@ -28,11 +38,49 @@ fn main() { } ``` +### CLI + +This project also provides a CLI utility with a similar interface to the well-known `base64` command. + +#### Installation + +To install `z-base-32` CLI you can build it from source or download prebuild binary from [releases](https://github.com/matusf/z-base-32/releases/latest). + +```console +cargo install --features cli z-base-32 +``` + +#### Example + +```console +$ zbase32 -h +z-base-32: human-oriented base-32 encoding + +Usage: zbase32 [OPTIONS] [FILE] + +Arguments: + [FILE] File to encode or decode + +Options: + -d, --decode Decode data + -w, --wrap Wrap encoded lines after COLS character [default: 76] + -h, --help Print help + -V, --version Print version +``` + ## Python +### Installation + +The `z-base-32` package is published at [PyPI](https://pypi.org/project/z-base-32/). Install it using the following command: + +```console +pip install z-base-32 +``` + ### Building -This crate can be compiled with feature flag `python` in which case it produces Python bindings. To build a Python wheels use [`maturin`](https://github.com/PyO3/maturin): +This crate can be compiled with the feature flag `python` in which case it produces Python bindings. To build Python wheels use [`maturin`](https://github.com/PyO3/maturin): ```console maturin build @@ -48,7 +96,7 @@ def decode(input: str) -> bytes: class DecodeError(Exception): ``` -#### Example +### Example ```py import zbase32