Add the following code to your project's shard.yml under:
dependencies
to use in production
- OR -
development_dependencies
to use in development
An adequate command-line random password generator for macOS.
The easiest way is via Homebrew.
brew tap mraffonso/randpass
brew install randpass
Use the provided Makefile to build a production release.
make
Then you can copy the binary to a location in your $PATH. For example:
mkdir -p $HOME/bin
cp build/randpass $HOME/bin
If it still does not work make sure the path is in your $PATH.
# If you use bash
echo 'export PATH="$PATH":"$HOME/bin"' >> .bashrc
# Or if you use ZSH
echo 'export PATH="$PATH":"$HOME/bin"' >> .zshrc
Randpass is very simple and there are three types of arguments randpass accepts for password generation.
Argument | Description | Default |
---|---|---|
length | List all new or modified files | 8 |
charsets | Show file differences that haven't been staged | dlsu |
count | List all new or modified files | 1x |
OK, so how do these charsets work? It's also very simple, you simply specity a string of the charset codes you wish to use.
In addition to the mandatory --help and --version, and their shorter variants, there is also a --charsets (-c for short) option to list the available charsets.
randpass --charsets # Shows available charsets
randpass -c # Also shows available charsets
randpass --help # Shows help
randpass -h # Also shows help
randpass --version # Shows version
randpass -v # Also shows version
A password 20 characters long with digits, lowercase and uppercase. It is not necessary to specify 1x, since that's the default.
randpass 20 dlu # PoCuQuVJ0rayYvOYWxcD
A password 16 characters long with binary only.
randpass 16 b # 1110011101010110
Four passwords 12 characters long with digits, lowercase, uppercase and specials. It is not necessary to specify "dlsu" since that's the default.
randpass 12 4x
# dyeuGs0lZXDM
# Gi605fBxTxc7
# Hy7ojyqvYJnA
# 58k9WXw5rb72
To develop randpass you'll need Crystal which is the only requirement.
All specs can by run with.
crystal spec