Files
Dominik Schulz 23dae78b13 feat: structured exit codes (I-2)
Addresses I-2 from the code quality audit: make gopass's exit codes
discoverable and stable for scripting users.

Changes:
- internal/action/exit/errors.go: replace iota with explicit integer
  constants so that inserting future codes cannot silently renumber
  existing ones; add PrintExitCodes(io.Writer) that renders a
  tab-aligned table of all 22 codes.
- main.go: add --exit-codes app-level flag; a Before hook calls
  PrintExitCodes and exits 0 when the flag is present.
- docs/exit-codes.md: new reference page with the full table and
  per-command breakdowns for show, insert, generate, find, delete,
  audit, fsck, and doctor.
- docs/commands/{show,insert,generate,find,delete,audit,fsck}.md:
  each gets a short '## Exit codes' section pointing at the reference
  page.
- ARCHITECTURE.md: expand the exit-package paragraph with a pointer
  to the docs and the stable-contract guarantee.
- tests/exitcodes_test.go: integration test asserting gopass
  --exit-codes exits 0 and prints representative codes/names.
- main_test.go: fix pre-existing count assertion (42→43, doctor was
  added in an earlier commit) and add .audit to commandsWithError
  (audit now returns an error when weak passwords are found, as fixed
  in B-7).
2026-04-12 09:44:52 +02:00

2.0 KiB

insert command

The insert command is used to manually set (insert, or change) a password in the store. It applies to either new or existing secrets.

Synopsis

$ gopass insert entry
$ gopass insert entry key

Modes of operation

  • Create a new entry with a user-supplied password, e.g. a new site with a user-generated password or one picked from gopass pwgen: gopass insert entry
  • Change an existing entry to a user-supplied password
  • Create and change any field of a new or existing secret: gopass insert entry key
  • Read data from STDIN and insert (or append) to a secret

Insert is similar in effect to gopass edit with the advantage of not displaying any content of the secret when changing a key.

Exit codes

Code Meaning
0 Secret inserted successfully
11 Existing secret could not be read for append or key-insert
12 Secret could not be encrypted and saved

See docs/exit-codes.md for the full table.

Note: insert will not change anything but the Password field (using the insert entry invocation) or the specified key (using the insert entry key invocation).

Flags

Flag Aliases Description
--echo -e Display the secret while typing (default: false)
--multiline -m Insert using $EDITOR (default: false). This identical to running gopass edit entry. All other flags are ignored.
--force -f Overwrite any existing value and do not prompt. (default: false)
--append -a Append to any existing data. Only applies if reading from STDIN. (default: false)