Sync with latest libmutton development version (new config file format)

This commit is contained in:
2025-12-17 00:41:44 -05:00
parent fb70b38dc3
commit 48ecf7cf83
4 changed files with 16 additions and 11 deletions
+1 -2
View File
@@ -5,7 +5,7 @@ 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.20251212003405-35db3bf20b8a
github.com/rwinkhart/libmutton v0.4.3-0.20251217053620-b591e2ef5a6d
golang.org/x/term v0.37.0
)
@@ -34,7 +34,6 @@ require (
golang.org/x/crypto v0.45.0 // indirect
golang.org/x/net v0.47.0 // indirect
golang.org/x/sys v0.38.0 // indirect
gopkg.in/ini.v1 v1.67.0 // indirect
gopkg.in/yaml.v2 v2.4.0 // indirect
)
+2 -4
View File
@@ -46,8 +46,8 @@ 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.20251212003405-35db3bf20b8a h1:RqfvWNKqoZbAXhKd9ieUeD8MO7sJu1Ieq+UjnUn+AVo=
github.com/rwinkhart/libmutton v0.4.3-0.20251212003405-35db3bf20b8a/go.mod h1:UF4UDldzEOwni81M95Wr5gPfiyoAEOaie8RBWiYC6Ng=
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/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=
@@ -70,8 +70,6 @@ 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=
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/ini.v1 v1.67.0 h1:Dgnx+6+nfE+IfzjUEISNeydPJh9AXNNsWbGP9KzCsOA=
gopkg.in/ini.v1 v1.67.0/go.mod h1:pNLf8WUiyNEtQjuu5G5vTm06TEv9tsIgeAvK8hOrP4k=
gopkg.in/yaml.v2 v2.4.0 h1:D8xgwECY7CYvx+Y2n4sBz93Jn9JRvxdiyyo8CTfuKaY=
gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
+5 -2
View File
@@ -198,7 +198,7 @@ func main() {
}
case "init":
err := core.LibmuttonInit(front.Input,
[][3]string{{"MUTN", "textEditor", getTextEditorInput()}},
map[string]any{"mutnTextEditor": getTextEditorInput()},
confirmRCWPassword("new"), false, false)
if err != nil {
other.PrintError("Initialization failed: "+err.Error(), 0)
@@ -226,7 +226,10 @@ func main() {
}
fmt.Println("\nRe-encryption complete.")
case 3:
err := cfg.WriteConfig([][3]string{{"MUTN", "textEditor", getTextEditorInput()}}, nil, true)
newCfg := &cfg.CfgT{}
newThirdPartyCfg := map[string]any{"mutnTextEditor": getTextEditorInput()}
newCfg.ThirdParty = &newThirdPartyCfg
err := cfg.WriteConfig(newCfg, true)
if err != nil {
other.PrintError("Failed to set text editor: "+err.Error(), back.ErrorWrite)
}
+8 -3
View File
@@ -95,11 +95,16 @@ func editNote(baseNote []string) ([]string, bool) {
}(tempFile.Name())
// fetch the user's text editor
editorCfg, err := cfg.ParseConfig([][2]string{{"MUTN", "textEditor"}})
cfg, err := cfg.LoadConfig()
if err != nil {
other.PrintError("Failed to retrieve text editor from libmutton.ini\n\nPlease specify one with \"mutn tweak\"", back.ErrorRead)
other.PrintError("Failed to load libmuttoncfg.json: "+err.Error(), back.ErrorRead)
}
var editor string
if value, exists := (*cfg.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)
}
editor := editorCfg[0]
// write baseNote to tempFile (if it is not empty)
baseNoteLen := len(baseNote)