Global flags work with every generator. Some generators also accept size flags, which are listed on their reference page.
Output#
| Flag | Effect |
|---|---|
-c, --count <n> | Generate n values, one per line. Maximum 10,000 |
--json | Emit JSON with generator, value, entropyBits and generator-specific fields |
-n, --no-newline | Do not append a trailing newline |
--copy | Copy the result to the clipboard |
--entropy | Print entropy bits to stderr |
--env <NAME> | Print NAME=value |
--prefix <str> | Prepend a literal string |
--suffix <str> | Append a literal string |
--no-color | Disable colors. NO_COLOR is also honored |
-h, --help | Show help |
-v, --version | Print 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 --copyIf 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.
| Flag | Meaning |
|---|---|
-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 2kLimits:
--lengthand--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 32is the same as:
$ mint bytes --bytes 32The shorthand accepts k and m suffixes and refuses to run if another size flag is also present.
Exit codes#
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | A runtime error after a valid invocation |
| 2 | Usage 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> --helpHelp output is generated from the same registry the dispatcher uses. If a flag is not listed for a command, that command rejects it.