Skip to content

feat: add profiles edit command#64

Merged
tito merged 2 commits intoGreyhavenHQ:mainfrom
TickTockBent:feat/profiles-edit
Mar 27, 2026
Merged

feat: add profiles edit command#64
tito merged 2 commits intoGreyhavenHQ:mainfrom
TickTockBent:feat/profiles-edit

Conversation

@TickTockBent
Copy link
Copy Markdown
Contributor

Summary

Adds greywall profiles edit <name> so users can tweak saved profiles without hunting for the file path and hand-validating JSON.

  • Opens the profile in $EDITOR (falls back to $VISUAL, then vi)
  • Validates the edited JSON on close via config.Load
  • On validation failure, prompts to re-edit or discard (restores original on discard)
  • Handles editors with flags (code --wait, emacs -nw)
  • Detects no-change exits early
  • Catches empty profiles (config.Load returns nil for those)
  • Updates profiles list output and parent help text to mention the new command

Closes #5

Test plan

  • greywall profiles edit <saved-profile> opens editor, validates on close
  • Invalid JSON after edit shows error and prompts re-edit/discard
  • Discarding restores the original file content
  • No-change edit prints "No changes made." and exits
  • Empty file after edit is caught as validation error
  • EDITOR="code --wait" works (split on whitespace)
  • Profile not found gives clear error pointing to profiles list
  • greywall profiles list footer now shows the edit hint

// squashing bugs, one cherry-pick at a time

Opens a saved profile in $EDITOR with validation on close. If the
edited profile fails validation, prompts to re-edit or discard.
Handles $EDITOR with flags (e.g. "code --wait"), detects no-change
exits, and catches empty profiles.

Closes GreyhavenHQ#5

// ticktockbent
@tito
Copy link
Copy Markdown
Contributor

tito commented Mar 27, 2026

@TickTockBent thank you! Can you fix the lint that i can merge ?

@tito tito merged commit aedbfef into GreyhavenHQ:main Mar 27, 2026
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.

Add edit command for template

2 participants