tofa code
Print the current TOTP code for one account. Takes the account id (or a prefix) as the first positional argument.
Synopsis
tofa code [FLAGS]
Flags
| Flag | Description |
|---|---|
--raw <RAW> | Output bare digits without space (for scripting) |
--copy <COPY> | Copy code to clipboard |
--watch <WATCH> | Refresh every second until Ctrl+C |
Examples
Print the code (with the conventional space):
$ tofa code GitHub:you
Passphrase: ********
482 913 (21s left)
Bare digits for scripts:
$ tofa code GitHub:you --raw
Passphrase: ********
482913
Copy to clipboard (uses your platform's clipboard handler):
$ tofa code GitHub:you --copy
Passphrase: ********
✓ copied
Live-watch a code (handy when typing it elsewhere):
$ tofa code GitHub:you --watch
482 913 (21s left)
482 913 (20s left)
...
Pipe to your own clipboard tool if --copy doesn't fit:
tofa code GitHub:you --raw | pbcopy # macOS
tofa code GitHub:you --raw | xclip # Linux
Notes
- The first argument is the account id or name — partial matches work.
If a prefix is ambiguous,
tofalists the candidates and exits non-zero. --raw,--copy,--watchare all switches; the<RAW>etc. placeholders in the auto-generated table above are a clap quirk for booleans.- Exit code
1on missing account, wrong passphrase, or ambiguous prefix.
See also
tofa list— see all accounts at once.- Recipe: clipboard — copy patterns by platform.