Skip to content

feat: edit command#21

Open
rmarganti wants to merge 3 commits into
mainfrom
edit-command
Open

feat: edit command#21
rmarganti wants to merge 3 commits into
mainfrom
edit-command

Conversation

@rmarganti

@rmarganti rmarganti commented Mar 16, 2026

Copy link
Copy Markdown
Owner

Adds a new edit subcommand and refactors the CLI to use proper subcommands.

Changes

edit subcommand

  • Opens secrets from any source (URI or preset) in the user's $VISUAL/$EDITOR (falls back to vi)
  • After editing, displays a git-style diff of changes and prompts for confirmation before writing back
  • Supports editing a preset's from or to side via --target
  • Handles parse errors gracefully by re-opening the editor
  • Detects no-op edits and empty files, aborting early

Refactor: CLI structure

  • init is now a proper subcommand instead of a magic --preset init value
  • Extracted SyncArgs from Args to cleanly separate sync-specific flags (--from, --to, --preset, --diff) from global flags (--config) and subcommands
  • Introduced Command enum (Init, Edit) for subcommand dispatch
  • Renamed new_jobbuild_sync_job to clarify its purpose
  • Simplified SyncArgs::validate by removing the special-case "init" check and unnecessary diff-mode branching

New dependencies

  • tempfile for safe temporary file creation during editing

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant