feat: e opens a repo's SOPS or .env file, in nvim, sops edit or your editor
Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
1 parent
6fab41703e
commit
c29319b821
11 files changed
+395
-12
No files matched your search
@@ -8,6 +8,7 @@ import (
|
||||
"fmt"
|
||||
"image/color"
|
||||
"math"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strings"
|
||||
"time"
|
||||
@@ -156,6 +157,8 @@ type Model struct {
|
||||
clip Clipboard
|
||||
clipClear time.Duration
|
||||
openURL func(string) error
|
||||
getenv func(string) string
|
||||
nvimOpen func(server, path string, line int) error // edit.go
|
||||
now func() time.Time
|
||||
|
||||
// A pending clear of a copied value, counted down in the footer.
|
||||
@@ -337,6 +340,8 @@ func New(providers []provider.Provider, opts Options) Model {
|
||||
clip: opts.Clipboard,
|
||||
clipClear: opts.ClipboardClear,
|
||||
now: time.Now,
|
||||
getenv: os.Getenv,
|
||||
nvimOpen: nvimOpen,
|
||||
cache: newCache(),
|
||||
}
|
||||
if m.clip == nil {
|
||||
@@ -522,6 +527,9 @@ func (m Model) Update(msg tea.Msg) (tea.Model, tea.Cmd) {
|
||||
case commandDoneMsg:
|
||||
m.handleCommandDone(msg)
|
||||
|
||||
case editDoneMsg:
|
||||
cmds = append(cmds, m.handleEditDone(msg))
|
||||
|
||||
case crawlMsg:
|
||||
cmds = append(cmds, m.handleCrawl(msg))
|
||||
|
||||
@@ -833,6 +841,8 @@ func (m *Model) handleKey(msg tea.KeyPressMsg) (cmd tea.Cmd, quit bool) {
|
||||
}
|
||||
case key.Matches(msg, k.Open):
|
||||
return m.openSelected(), false
|
||||
case key.Matches(msg, k.Edit):
|
||||
return m.edit(), false
|
||||
case key.Matches(msg, k.Login):
|
||||
if m.auth != nil && len(m.auth.Login) > 0 {
|
||||
c := exec.Command(m.auth.Login[0], m.auth.Login[1:]...)
|
||||
|
||||
Reference in new issue
Block a user