diff --git a/go.mod b/go.mod index f6d75ff..87fce3d 100644 --- a/go.mod +++ b/go.mod @@ -5,8 +5,8 @@ go 1.25.5 require ( github.com/charmbracelet/glamour v0.7.0 github.com/rwinkhart/go-boilerplate v0.1.1-0.20251211171453-df1fb21b2366 - github.com/rwinkhart/libmutton v0.4.3-0.20251217053620-b591e2ef5a6d - golang.org/x/term v0.37.0 + github.com/rwinkhart/libmutton v0.4.3-0.20251227002819-53d82984d994 + golang.org/x/term v0.38.0 ) require ( @@ -14,11 +14,12 @@ require ( github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/boombuler/barcode v1.1.0 // indirect + github.com/clipperhouse/uax29/v2 v2.2.0 // indirect github.com/gorilla/css v1.0.1 // indirect github.com/kr/fs v0.1.0 // indirect - github.com/lucasb-eyer/go-colorful v1.2.0 // indirect + github.com/lucasb-eyer/go-colorful v1.3.0 // indirect github.com/mattn/go-isatty v0.0.20 // indirect - github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/mattn/go-runewidth v0.0.19 // indirect github.com/microcosm-cc/bluemonday v1.0.27 // indirect github.com/muesli/reflow v0.3.0 // indirect github.com/muesli/termenv v0.16.0 // indirect @@ -28,16 +29,16 @@ require ( github.com/rivo/uniseg v0.4.7 // indirect github.com/rwinkhart/go-highlite v0.1.1 // indirect github.com/rwinkhart/peercred-mini v0.1.2 // indirect - github.com/rwinkhart/rcw v0.2.3 // indirect + github.com/rwinkhart/rcw v0.2.4 // indirect github.com/yuin/goldmark v1.7.13 // indirect github.com/yuin/goldmark-emoji v1.0.6 // indirect - golang.org/x/crypto v0.45.0 // indirect - golang.org/x/net v0.47.0 // indirect - golang.org/x/sys v0.38.0 // indirect + golang.org/x/crypto v0.46.0 // indirect + golang.org/x/net v0.48.0 // indirect + golang.org/x/sys v0.39.0 // indirect gopkg.in/yaml.v2 v2.4.0 // indirect ) -replace golang.org/x/sys => github.com/rwinkhart/sys v0.38.0 +replace golang.org/x/sys => github.com/rwinkhart/sys v0.39.0 replace github.com/Microsoft/go-winio => github.com/rwinkhart/go-winio v0.1.0 diff --git a/go.sum b/go.sum index 5be9536..36ceda9 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,8 @@ github.com/aymerick/douceur v0.2.0/go.mod h1:wlT5vV2O3h55X9m7iVYN0TBM0NH/MmbLnd3 github.com/boombuler/barcode v1.0.1-0.20190219062509-6c824513bacc/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= github.com/boombuler/barcode v1.1.0 h1:ChaYjBR63fr4LFyGn8E8nt7dBSt3MiU3zMOZqFvVkHo= github.com/boombuler/barcode v1.1.0/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= +github.com/clipperhouse/uax29/v2 v2.2.0 h1:ChwIKnQN3kcZteTXMgb1wztSgaU+ZemkgWdohwgs8tY= +github.com/clipperhouse/uax29/v2 v2.2.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= @@ -12,14 +14,14 @@ github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= github.com/kr/fs v0.1.0 h1:Jskdu9ieNAYnjxsi0LbQp1ulIKZV1LAFgK1tWhpZgl8= github.com/kr/fs v0.1.0/go.mod h1:FFnZGqtBN9Gxj7eW1uZ42v5BccTP0vu6NEaFoC2HwRg= -github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY= -github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= +github.com/lucasb-eyer/go-colorful v1.3.0 h1:2/yBRLdWBZKrf7gB40FoiKfAWYQ0lqNcbuQwVHXptag= +github.com/lucasb-eyer/go-colorful v1.3.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0= github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY= github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y= github.com/mattn/go-runewidth v0.0.9/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI= github.com/mattn/go-runewidth v0.0.12/go.mod h1:RAqKPSqVFrSLVXbA8x7dzmKdmGzieGRCM46jaSJTDAk= -github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc= -github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w= +github.com/mattn/go-runewidth v0.0.19 h1:v++JhqYnZuu5jSKrk9RbgF5v4CGUjqRfBm05byFGLdw= +github.com/mattn/go-runewidth v0.0.19/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs= github.com/microcosm-cc/bluemonday v1.0.27 h1:MpEUotklkwCSLeH+Qdx1VJgNqLlpY2KXwXFM08ygZfk= github.com/microcosm-cc/bluemonday v1.0.27/go.mod h1:jFi9vgW+H7c3V0lb6nR74Ib/DIB5OBs92Dimizgw2cA= github.com/muesli/reflow v0.3.0 h1:IFsN6K9NfGtjeggFP+68I4chLZV2yIKsXJFNZ+eWh6s= @@ -46,14 +48,14 @@ github.com/rwinkhart/go-highlite v0.1.1 h1:9TxbRhYVfD/3YaEgNk1BtEiZ0t8/5mxDUZqNM github.com/rwinkhart/go-highlite v0.1.1/go.mod h1:mWLMtCWcyV0BG4NeyPyAUGMjPvI0ds6vXmUq89QwBFA= github.com/rwinkhart/go-winio v0.1.0 h1:b72agLW+dETGmhR3VbcbwnStfgKfc5AfgJOXBJDkaHg= github.com/rwinkhart/go-winio v0.1.0/go.mod h1:ZWa7ssZJT30CCDGJ7fk/2SBTq9BIQrrVjrcss0UW2s0= -github.com/rwinkhart/libmutton v0.4.3-0.20251217053620-b591e2ef5a6d h1:+ckGdP5Dq2sY9sWCT5Yz84M3xtp8H1et6lQEyRwGT3Q= -github.com/rwinkhart/libmutton v0.4.3-0.20251217053620-b591e2ef5a6d/go.mod h1:Xi62SIv9p4jF48Uybv9tjVSI4sC8eKK+brXLndY9YdE= +github.com/rwinkhart/libmutton v0.4.3-0.20251227002819-53d82984d994 h1:SWaYFP09lpCfyAhYkjhwfkvlAzDgAVLLCaECubTWa0I= +github.com/rwinkhart/libmutton v0.4.3-0.20251227002819-53d82984d994/go.mod h1:nOEBckA0iNZePuXzkxpTlzBevKQlZqkvwstZjMB3yBU= github.com/rwinkhart/peercred-mini v0.1.2 h1:4cGWDbv0whvLeVvbUdx84V/9p+2fS+DEXgrA1KxlRFo= github.com/rwinkhart/peercred-mini v0.1.2/go.mod h1:LLHG7YshHEpbpJJP+Il9nx2dnGj5O3VGE32rWmflj0c= -github.com/rwinkhart/rcw v0.2.3 h1:g1rVaspZnZM8nWupeSdVO827di4ORMZnczw6iXyo01Y= -github.com/rwinkhart/rcw v0.2.3/go.mod h1:wb+uRyOuMO7TXdZzWD+krnMaeu1QLWK7+OoyWex1JqA= -github.com/rwinkhart/sys v0.38.0 h1:V1PGKcUutWtD3+VdHvyvfGtPy7PDXzKHNM1IzVq1ysY= -github.com/rwinkhart/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +github.com/rwinkhart/rcw v0.2.4 h1:FrRSsl+ui1WLmDwqjLSROtFPKqSeGLEfF2SPENt4qP0= +github.com/rwinkhart/rcw v0.2.4/go.mod h1:nhW4RAHvEjW2QcOlqEdWqRQOFJLjoOGSPkSRZlMjU3s= +github.com/rwinkhart/sys v0.39.0 h1:bSBJcThxIIKWIq86zagXaJ7Z5sCoPF78lsyq1kANVEM= +github.com/rwinkhart/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI= github.com/stretchr/testify v1.10.0 h1:Xv5erBjTwe/5IxqUQTdXv5kgmIvbHo3QQyRwhJsOfJA= @@ -62,12 +64,12 @@ github.com/yuin/goldmark v1.7.13 h1:GPddIs617DnBLFFVJFgpo1aBfe/4xcvMc3SB5t/D0pA= github.com/yuin/goldmark v1.7.13/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= github.com/yuin/goldmark-emoji v1.0.6 h1:QWfF2FYaXwL74tfGOW5izeiZepUDroDJfWubQI9HTHs= github.com/yuin/goldmark-emoji v1.0.6/go.mod h1:ukxJDKFpdFb5x0a5HqbdlcKtebh086iJpI31LTKmWuA= -golang.org/x/crypto v0.45.0 h1:jMBrvKuj23MTlT0bQEOBcAE0mjg8mK9RXFhRH6nyF3Q= -golang.org/x/crypto v0.45.0/go.mod h1:XTGrrkGJve7CYK7J8PEww4aY7gM3qMCElcJQ8n8JdX4= -golang.org/x/net v0.47.0 h1:Mx+4dIFzqraBXUugkia1OOvlD6LemFo1ALMHjrXDOhY= -golang.org/x/net v0.47.0/go.mod h1:/jNxtkgq5yWUGYkaZGqo27cfGZ1c5Nen03aYrrKpVRU= -golang.org/x/term v0.37.0 h1:8EGAD0qCmHYZg6J17DvsMy9/wJ7/D/4pV/wfnld5lTU= -golang.org/x/term v0.37.0/go.mod h1:5pB4lxRNYYVZuTLmy8oR2BH8dflOR+IbTYFD8fi3254= +golang.org/x/crypto v0.46.0 h1:cKRW/pmt1pKAfetfu+RCEvjvZkA9RimPbh7bhFjGVBU= +golang.org/x/crypto v0.46.0/go.mod h1:Evb/oLKmMraqjZ2iQTwDwvCtJkczlDuTmdJXoZVzqU0= +golang.org/x/net v0.48.0 h1:zyQRTTrjc33Lhh0fBgT/H3oZq9WuvRR5gPC70xpDiQU= +golang.org/x/net v0.48.0/go.mod h1:+ndRgGjkh8FGtu1w1FGbEC31if4VrNVMuKTgcAAnQRY= +golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q= +golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY= diff --git a/mutn.go b/mutn.go index 218dc2e..1cc662c 100644 --- a/mutn.go +++ b/mutn.go @@ -185,7 +185,7 @@ func main() { } else { switch args[1] { case "clipclear": - err := clip.ClipClearArgument() + err := clip.ClearArgument() if err != nil { other.PrintError("Failure occurred in clipboard clearing process: "+err.Error(), global.ErrorClipboard) } @@ -226,7 +226,7 @@ func main() { } fmt.Println("\nRe-encryption complete.") case 3: - newCfg := &cfg.CfgT{} + newCfg := &cfg.ConfigT{} newThirdPartyCfg := map[string]any{"mutnTextEditor": getTextEditorInput()} newCfg.ThirdParty = &newThirdPartyCfg err := cfg.WriteConfig(newCfg, true) @@ -236,7 +236,7 @@ func main() { case 4: forceReage := front.InputBinary("Re-age aged entries?") fmt.Println("Aging entries; this may take awhile - do not terminate this process") - err := age.AgeAllPasswordEntries(forceReage) + err := age.AllPasswordEntries(forceReage) if err != nil { other.PrintError("Failed to age entries: "+err.Error(), 1) } diff --git a/src/cli/copyMenu.go b/src/cli/copyMenu.go index e6190d7..a0c24d4 100644 --- a/src/cli/copyMenu.go +++ b/src/cli/copyMenu.go @@ -62,7 +62,9 @@ func CopyMenu(vanityPath string, decSlice []string, oldPassword string) { signal.Notify(sigChan, os.Interrupt, syscall.SIGTERM) go func() { <-sigChan - clip.ClipClearProcess("") + if err = clip.ClearProcess(""); err != nil { + other.PrintError("Failed to clear clipboard on exit", global.ErrorClipboard) + } os.Exit(0) }() diff --git a/src/cli/edit.go b/src/cli/edit.go index bf5772f..2c455b3 100644 --- a/src/cli/edit.go +++ b/src/cli/edit.go @@ -95,12 +95,12 @@ func editNote(baseNote []string) ([]string, bool) { }(tempFile.Name()) // fetch the user's text editor - cfg, err := cfg.LoadConfig() + config, err := cfg.LoadConfig() if err != nil { other.PrintError("Failed to load libmuttoncfg.json: "+err.Error(), back.ErrorRead) } var editor string - if value, exists := (*cfg.ThirdParty)["mutnTextEditor"]; !exists { + if value, exists := (*config.ThirdParty)["mutnTextEditor"]; !exists { other.PrintError("Failed to retrieve text editor from libmuttoncfg.json\n\nPlease specify one with \"mutn tweak\"", back.ErrorRead) } else { editor = value.(string) @@ -165,7 +165,6 @@ func editNote(baseNote []string) ([]string, bool) { noteLen := len(note) if !reflect.DeepEqual(note, baseNote) && (noteLen > 0 || baseNoteLen != noteLen) { return note, true - } else { - return nil, false } + return nil, false } diff --git a/src/cli/entryReader.go b/src/cli/entryReader.go index e2b3ec3..2f78db9 100644 --- a/src/cli/entryReader.go +++ b/src/cli/entryReader.go @@ -55,6 +55,7 @@ fieldLoop: // render notes as Markdown r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width)) markdownNotesString, _ := r.Render(strings.Join(decSlice[4:], "\n")) + _ = r.Close() // print the rendered Markdown notes fmt.Print(markdownNotesString)