gp-tui integrates with gopass by invoking the CLI through os/exec in internal/gopass/service.go.
The application treats gopass as the source of truth. It does not parse or manipulate the password store directly.
Used by CLIService.List().
Purpose:
- fetch all entries as flat paths
- provide the initial dataset used to build the in-memory tree
The output is trimmed, split by line, and converted to a []string.
Used by CLIService.Show().
Purpose:
- load the full content of an entry
- support password reveal in the preview area
The raw command output is returned as a string.
Used by CLIService.ShowCommand().
Purpose:
- trigger the startup unlock flow before Bubble Tea starts
- let
gopasssurface any interactive unlock prompt directly in the terminal
The command is run as an interactive process and its standard output is discarded so the secret is not printed during startup.
Used by CLIService.Copy().
Purpose:
- delegate clipboard handling to
gopass - keep clipboard behavior outside the TUI layer
The command is executed for its side effect. On success, the UI shows a confirmation message.
Used by CLIService.SyncCommand().
Purpose:
- run a sync immediately after startup unlock
- surface SSH authentication prompts before the TUI opens
The command is run as an interactive process during startup.
Used by CLIService.EditCommand().
Purpose:
- open an existing entry in the user's editor
- keep editing delegated to
gopass
The UI runs the command as an interactive process. On success, it reloads the tree and refreshes the preview for the edited entry.
Used by CLIService.CreateCommand().
Purpose:
- create a new entry when the user declines password generation in the
nflow - keep entry creation delegated to
gopass - allow the first entry to be created even when the store view is empty
The n flow always starts by collecting the entry path. The UI then asks Generate password? [y/N]. When the user answers n or presses enter, it runs gopass edit --create -- <path>.
The UI runs the command as an interactive process. On success, it reloads the tree, focuses the new entry, and loads a masked preview.
Used by CLIService.GenerateCommand() through a simplified GenerateRequest.
Purpose:
- create a new entry from the
nflow when the user chooses password generation - regenerate the password for the current entry from
r - keep password generation delegated to
gopass - expose only the generation options that are actually supported in the TUI
The TUI flow is:
nasks for the new entry path, thenGenerate password? [y/N].- If the answer is
no, the UI runsgopass edit --create -- <path>. - If the answer is
yes, the UI asksQuick generation with recommended defaults? [Y/n]. - Quick generation uses:
- generator
cryptic - length
24 --symbols--strict
- generator
- If quick generation is declined, the full wizard collects:
- optional key
- generator:
cryptic,memorable,xkcd,external - length
- conditional options:
cryptic→symbols,strictxkcd→separator,language
For regeneration, the flow starts with an overwrite confirmation. The request always includes --force so gopass can replace the existing entry.
GenerateRequest now contains only the fields still exposed by the TUI:
PathKeyLengthForceSymbolsGeneratorStrictSeparatorLanguage
On success:
- new generated entries are opened automatically in
gopass edit - regenerated entries reload the tree and masked preview, then prompt
Edit <path> now? [y/N]
Used by CLIService.Move().
Purpose:
- move an entry to another directory in the store
- back the TUI cut and paste workflow without reimplementing store operations
The command is executed for its side effect. On success, the UI reloads the tree from gopass.
Used by CLIService.Delete().
Purpose:
- remove an entry from the store
- back the TUI delete confirmation flow without reimplementing store operations
The command is executed for its side effect. On success, the UI reloads the tree from gopass.
CLIService.ShowMasked() is implemented on top of Show().
Behavior:
- Load the full entry content.
- Split it into at most two parts.
- Replace the first line with
********. - Keep the remaining lines unchanged.
This lets the UI show metadata stored below the password line while hiding the secret by default.
Errors from command execution are wrapped with command context, for example:
gopass ls --flat failedgopass show path failedgopass show -c path failedgopass edit path failedgopass edit --create path failedgopass generate ... -- path [key] length failedgopass mv source destination failedgopass rm -f -- path failed
The UI displays those errors in the preview area when an operation fails.
The current test suite focuses on creation safety and command wiring without touching a real password store.
main_test.gocovers the startupshowthensyncsequenceinternal/gopass/service_test.gochecks the command arguments built for startup, edit, create, and the simplified structured generate requestinternal/ui/input_test.gocovers inline entry creation input, quick generation, the full generate wizard, regeneration confirmation, post-regeneration edit confirmation, delete confirmation, local search behavior, empty-state rendering, and validation errors
These tests use fakes and harmless subprocesses, so they do not modify the user's existing gopass store.
- the service contract used by the UI is small:
List,ShowCommand,SyncCommand,Show,ShowMasked,EditCommand,CreateCommand,GenerateCommand,Copy,Delete, andMove - command execution accepts
context.Contextand usesexec.CommandContext - stdout and stderr are handled separately so warnings do not pollute successful command output
- Bubble Tea side effects are triggered through commands and messages, then the tree is reloaded from
gopass - search is local to the already loaded store tree; it does not call
gopass find