mint_
Documentation menu
On this page

Generators / Documentation

Global flags

Count, JSON, env, entropy, copy, sizes and exit codes.

Global flags work with every generator. Some generators also accept size flags, which are listed on their reference page.

Output#

FlagEffect
-c, --count <n>Generate n values, one per line. Maximum 10,000
--jsonEmit JSON with generator, value, entropyBits and generator-specific fields
-n, --no-newlineDo not append a trailing newline
--copyCopy the result to the clipboard
--entropyPrint entropy bits to stderr
--env <NAME>Print NAME=value
--prefix <str>Prepend a literal string
--suffix <str>Append a literal string
--no-colorDisable colors. NO_COLOR is also honored
-h, --helpShow help
-v, --versionPrint the version

Count#

$ mint hex --bytes 4 --count 3
9f4c1a2b
44d3e8a0
cc38e17d

--count also works with generators that handle repetition themselves, such as pick, shuffle and dice.

JSON#

$ mint hex --bytes 4 --json
{
  "generator": "hex",
  "value": "9f4c1a2b",
  "entropyBits": 32,
  "encoding": "hex",
  "bytes": 4
}

With --count, JSON output is an array.

Environment variables#

$ mint token --bytes 32 --env API_TOKEN
API_TOKEN=<redacted>

With --count, names are suffixed:

$ mint token --bytes 32 --count 2 --env API_TOKEN
API_TOKEN_1=<redacted>
API_TOKEN_2=<redacted>

apikey and webhook-secret use --prefix as part of the secret itself. Other generators use it as an output decoration.

Clipboard#

$ mint password --length 32 --copy

If no clipboard helper is available, mint warns on stderr and still prints the value. The command does not fail.

Entropy#

$ mint uuid --entropy
33c6e3de-6cb2-4075-b21c-1547149ccbde
entropy: 122 bits

--entropy writes to stderr, keeping stdout safe for pipes. With --count, it reports bits each and the total.

Sizes#

These flags are available on generators that declare them. They are mutually exclusive.

FlagMeaning
-l, --length <n>Exact output character count
--size <n>Alias for --length
-b, --bytes <n>Entropy: draw this many random bytes
--bits <n>Entropy: draw this many random bits

k and m suffixes are accepted by size flags:

$ mint hex --length 1k
$ mint base64url --length 2k
$ mint token --bytes 2k

Limits:

  • --length and --size: 1 to 1,000,000 characters.
  • --bytes: 1 to 1,048,576 bytes.
  • --bits: 1 to 8,388,608 bits.
  • --count: 1 to 10,000.

Do not combine --length with --bytes or --bits. Do not combine --length with --size.

Shorthand#

$ mint 32

is the same as:

$ mint bytes --bytes 32

The shorthand accepts k and m suffixes and refuses to run if another size flag is also present.

Exit codes#

CodeMeaning
0Success
1A runtime error after a valid invocation
2Usage error: unknown command or flag, invalid value, unsupported combination

mint guard has its own contract: 0 clean, 1 findings at or above --fail-on, 2 usage or runtime error. See mint guard output.

Help#

mint --help
mint <command> --help
mint guard --help
mint guard <command> --help

Help output is generated from the same registry the dispatcher uses. If a flag is not listed for a command, that command rejects it.