Expand description
human-ids
Create simple human readable IDs
§What?
This is a Rust “fork” of the TypeScript/JavaScript library human-id
written by RienNeVaPlus, just rewritten in Rust. Used to generate friendly
IDs like those used in changesets
. Can be used either as a library or a binary.
§Library
§Installation
- Add id:
cargo add human_ids
- Use it:
use human_ids::generate(None)
§Usage
For usage documentation, see the docs.rs page.
§Binary
§Usage
$ human_ids -h
Usage: human_ids [OPTIONS]
Options:
--completion <COMPLETION>
Generate shell completion scripts [possible values: bash, elvish, fish, powershell, zsh]
-s, --separator <SEPARATOR>
The separator to use between words [default: -]
-c, --capitalize
Capitalize each word
-a, --adverb
Add an adverb
-n, --num-adjectives <NUM_ADJECTIVES>
The number of adjectives to use [default: 1]
-h, --help
Print help (see more with '--help')
-V, --version
Print version
$ human_ids -s '~' -c
Happy~Mirrors~Matter
§Completion
If your method of installation didn’t include shell completion, you can manually
source or save them with the human_ids --completion <shell>
command.
§Help
Finally, help is always available with human-ids -h
(or --help
if your installation
included man pages).
§Installation
Currently, the package is available a couple of places, including Homebrew, AUR and Nix.
- Cargo
cargo install human-ids-bin
- Homebrew
-
brew tap sondr3/homebrew-taps
brew install human-ids-bin
You can also download the matching release from the release
tab, extracting the archive and
placing the binary in your $PATH
. Note that for Linux the
unknown-linux-musl.tar.gz
is preferred as it is statically linked and thus
should run on any Linux distribution.
§LICENSE
MIT.
Re-exports§
pub use constants::ADJECTIVES;
pub use constants::ADVERBS;
pub use constants::NOUNS;
pub use constants::VERBS;
Modules§
Structs§
Functions§
- Generate a human-readable identifier
- Returns the longest element from the given vector
- Returns a random element from the given vector
- Returns the shortest element from the given vector