3 releases

0.0.3 Nov 7, 2023
0.0.2 Nov 7, 2023
0.0.1 Nov 7, 2023

#830 in Text processing

40 downloads per month

GPL-3.0 license

22KB
96 lines

cha-rs

Crates.io Docs.rs CI

A simple library and app to extract specific characters from an input string. Useful for when you need to verify arbitrary characters of your long random password for your bank.
For example:

$ bw get password <mybank> | cha-rs -c 3 -c 11 -c 16
# 3 => C
# 11 => !
# 16 => p

(Please note, those characters are made up and do not belong to any of my passwords! :D)

Originally I created a pull request to Bitwarden (https://github.com/bitwarden/clients/pull/5042) to add this functionality to the command line app. But that feels a bit over-engineered and it is more inline with the Unix philosophy to create a small program that does one thing well, accepting text as its input, and writing text as its output. So here it is!

Installation

Cargo

  • Install the rust toolchain in order to have cargo installed by following this guide.
  • run cargo install cha-rs

From source

  • Build and install the executable from the source code.
git clone https://github.com/jj-style/cha-rs.git
cd cha-rs
cargo install --path .

Docker

docker pull ghcr.io/jj-style/cha-rs:latest
echo hello | docker run --rm -i ghcr.io/jj-style/cha-rs -c 1 -c 3 -c 5

Contribution

See CONTRIBUTING.md.

Notes

Project template generated using https://rust-github.github.io/.

Dependencies

~1.2–1.8MB
~35K SLoC