diff --git a/README.md b/README.md index 404e258..f819bf6 100644 --- a/README.md +++ b/README.md @@ -31,8 +31,7 @@ After installing, please review the [usage guide](https://github.com/rwinkhart/M - [x] Implement tweak menu ### Release v0.4.0 - [ ] Switch to fully compliant Markdown (do not preserve new lines) -- [ ] Evaluate defaulting to building w/Bean over Glamour - - [ ] Verify having Glamour in go.mod does not impact binary size/speed (drop it if it does) +- [ ] Switch to alternative Markdown renderer (minimark or BEAN) ### Release v0.5.0 - [ ] libmutton v0.5.0 - [ ] Password aging support diff --git a/go.mod b/go.mod index cf470de..02606f4 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,6 @@ module github.com/rwinkhart/MUTN go 1.24.4 require ( - github.com/Trojan2021/BEAN v0.0.0-20241210230804-8f294833b514 github.com/charmbracelet/glamour v0.7.0 github.com/rwinkhart/go-boilerplate v0.0.0-20250601205829-83b0be1379fd github.com/rwinkhart/libmutton v0.3.2-0.20250619183947-37a1a6049fec @@ -15,7 +14,6 @@ require ( github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect github.com/boombuler/barcode v1.0.2 // indirect - github.com/charmbracelet/x/ansi v0.9.2 // 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 @@ -28,7 +26,6 @@ require ( github.com/pkg/sftp v1.13.9 // indirect github.com/pquerna/otp v1.5.0 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/rwinkhart/convertroman v0.2.0 // indirect github.com/rwinkhart/go-highlite v0.1.1 // indirect github.com/rwinkhart/peercred-mini v0.1.0 // indirect github.com/rwinkhart/rcw v0.2.0 // indirect diff --git a/go.sum b/go.sum index cb4a86a..4bc69fe 100644 --- a/go.sum +++ b/go.sum @@ -1,5 +1,3 @@ -github.com/Trojan2021/BEAN v0.0.0-20241210230804-8f294833b514 h1:PbqBQdkQ51VLfwemHdp3DqDAeMoPqzGSK39ZtFHJLG0= -github.com/Trojan2021/BEAN v0.0.0-20241210230804-8f294833b514/go.mod h1:Xkl7xpjhrhefSpFAJEc1uNIarmVU+EFASB8VLODTOsA= github.com/aymanbagabas/go-osc52/v2 v2.0.1 h1:HwpRHbFMcZLEVr42D4p7XBqjyuxQH5SMiErDT4WkJ2k= github.com/aymanbagabas/go-osc52/v2 v2.0.1/go.mod h1:uYgXzlJ7ZpABp8OJ+exZzJJhRNQ2ASbcXHWsFqH8hp8= github.com/aymerick/douceur v0.2.0 h1:Mv+mAeH1Q+n9Fr+oyamOlAkUNPWPlA8PPGR0QAaYuPk= @@ -7,8 +5,6 @@ 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.0.2 h1:79yrbttoZrLGkL/oOI8hBrUKucwOL0oOjUgEguGMcJ4= github.com/boombuler/barcode v1.0.2/go.mod h1:paBWMcWSl3LHKBqUq+rly7CNSldXjb2rDl3JlRe0mD8= -github.com/charmbracelet/x/ansi v0.9.2 h1:92AGsQmNTRMzuzHEYfCdjQeUzTrgE1vfO5/7fEVoXdY= -github.com/charmbracelet/x/ansi v0.9.2/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE= 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= @@ -43,8 +39,6 @@ github.com/rivo/uniseg v0.1.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJ github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc= github.com/rivo/uniseg v0.4.7 h1:WUdvkW8uEhrYfLC4ZzdpI2ztxP1I582+49Oc5Mq64VQ= github.com/rivo/uniseg v0.4.7/go.mod h1:FN3SvrM+Zdj16jyLfmOkMNblXMcoc8DfTHruCPUcx88= -github.com/rwinkhart/convertroman v0.2.0 h1:otUm939eXT77q/Lr31mJtMwVWEw0RjEUB71gO65h9OM= -github.com/rwinkhart/convertroman v0.2.0/go.mod h1:Af6HqvX0EIM4Y3HcnNXbbRey1dLasGB7WU0+3Cowgmw= github.com/rwinkhart/glamour-temp-MUTN v0.7.2 h1:/CBexwkGdL8HuZjO7M0zzjGHaHCr9/r4XTOtUJa+pPE= github.com/rwinkhart/glamour-temp-MUTN v0.7.2/go.mod h1:DN/eJaNQ5h7dgxzfmWFo7By+b82CKEUdNaY6z4R4v3c= github.com/rwinkhart/go-boilerplate v0.0.0-20250601205829-83b0be1379fd h1:qUFlOLvBx/dzQBW/zgFjSJ2EjrFb/lOQXs9q0sDW05g= @@ -53,8 +47,6 @@ 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-easy-pipe-handles v0.0.0-20250407031321-96994a0e8410 h1:NhHwFM3Pgm6zRUfFKvi0p5ndjfFbVWsRwmmhyFlG4PE= github.com/rwinkhart/go-winio-easy-pipe-handles v0.0.0-20250407031321-96994a0e8410/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= -github.com/rwinkhart/libmutton v0.3.2-0.20250601210140-c0f55156d8a9 h1:zU+oB0UJyYNW/A1an8oEzKQ8G8EaHJQMbTtkmXV72YU= -github.com/rwinkhart/libmutton v0.3.2-0.20250601210140-c0f55156d8a9/go.mod h1:3yxNX+KoxDQBg2C4DKu8/WXOALfeql46Q5CKUdv4dIk= github.com/rwinkhart/libmutton v0.3.2-0.20250619183947-37a1a6049fec h1:dlfrRi36eMhjILGCXg+j7aE3P6ITjApxAWtmQkbDodM= github.com/rwinkhart/libmutton v0.3.2-0.20250619183947-37a1a6049fec/go.mod h1:2WR6aaQkfCF5KrU0zdU98yvFBdDnFXzQNgR6xzrWQxs= github.com/rwinkhart/peercred-mini v0.1.0 h1:TiS6u8cEWzW55S9X4iVpU72Iuy/NG6rMUJMtUEVEFLw= @@ -75,8 +67,7 @@ github.com/yuin/goldmark v1.7.12 h1:YwGP/rrea2/CnCtUHgjuolG/PnMxdQtPMO5PvaE2/nY= github.com/yuin/goldmark v1.7.12/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.design/x/clipboard v0.7.0 h1:4Je8M/ys9AJumVnl8m+rZnIvstSnYj1fvzqYrU3TXvo= -golang.design/x/clipboard v0.7.0/go.mod h1:PQIvqYO9GP29yINEfsEn5zSQKAz3UgXmZKzDA6dnq2E= +golang.design/x/clipboard v0.7.1 h1:OEG3CmcYRBNnRwpDp7+uWLiZi3hrMRJpE9JkkkYtz2c= golang.design/x/clipboard v0.7.1/go.mod h1:i5SiIqj0wLFw9P/1D7vfILFK0KHMk7ydE72HRrUIgkg= golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= @@ -86,14 +77,11 @@ golang.org/x/crypto v0.23.0/go.mod h1:CKFgDieR+mRhux2Lsu27y0fO304Db0wZe70UKqHu0v golang.org/x/crypto v0.31.0/go.mod h1:kDsLvtWBEx7MV9tJOj9bnXsPbxwJQ6csT/x4KIN4Ssk= golang.org/x/crypto v0.39.0 h1:SHs+kF4LP+f+p14esP5jAoDpHU8Gu/v9lFRK6IT5imM= golang.org/x/crypto v0.39.0/go.mod h1:L+Xg3Wf6HoL4Bn4238Z6ft6KfEpN0tJGo53AAPC632U= -golang.org/x/exp/shiny v0.0.0-20250506013437-ce4c2cf36ca6 h1:OKqTTvTtXrxCm19HtttLTgySk+NUt9mcsKAq827Ltz4= -golang.org/x/exp/shiny v0.0.0-20250506013437-ce4c2cf36ca6/go.mod h1:ygj7T6vSGhhm/9yTpOQQNvuAUFziTH7RUiH74EoE2C8= +golang.org/x/exp/shiny v0.0.0-20250606033433-dcc06ee1d476 h1:Wdx0vgH5Wgsw+lF//LJKmWOJBLWX6nprsMqnf99rYDE= golang.org/x/exp/shiny v0.0.0-20250606033433-dcc06ee1d476/go.mod h1:ygj7T6vSGhhm/9yTpOQQNvuAUFziTH7RUiH74EoE2C8= -golang.org/x/image v0.27.0 h1:C8gA4oWU/tKkdCfYT6T2u4faJu3MeNS5O8UPWlPF61w= -golang.org/x/image v0.27.0/go.mod h1:xbdrClrAUway1MUTEZDq9mz/UpRwYAkFFNUslZtcB+g= +golang.org/x/image v0.28.0 h1:gdem5JW1OLS4FbkWgLO+7ZeFzYtL3xClb97GaUzYMFE= golang.org/x/image v0.28.0/go.mod h1:GUJYXtnGKEUgggyzh+Vxt+AviiCcyiwpsl8iQ8MvwGY= -golang.org/x/mobile v0.0.0-20250506005352-78cd7a343bde h1:klxJIHHSTIJItwhIaVT2EydFn+8urdz5cnisEO0Uy6I= -golang.org/x/mobile v0.0.0-20250506005352-78cd7a343bde/go.mod h1:T9M84Yhr+nZUSLopZMA95xrVLgn6hC6YwibPkqR8/hw= +golang.org/x/mobile v0.0.0-20250606033058-a2a15c67f36f h1:/n+PL2HlfqeSiDCuhdBbRNlGS/g2fM4OHufalHaTVG8= golang.org/x/mobile v0.0.0-20250606033058-a2a15c67f36f/go.mod h1:ESkJ836Z6LpG6mTVAhA48LpfW/8fNR0ifStlH2axyfg= golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= diff --git a/packaging/resources/apkbuild-source-stable-optimized.sh b/packaging/resources/apkbuild-source-stable-optimized.sh index bc27da2..dd72c40 100644 --- a/packaging/resources/apkbuild-source-stable-optimized.sh +++ b/packaging/resources/apkbuild-source-stable-optimized.sh @@ -41,7 +41,7 @@ build() { esac # compile binary - CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath ./mutn.go + CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go } package() { diff --git a/packaging/resources/pkgbuild-git-stable-optimized.sh b/packaging/resources/pkgbuild-git-stable-optimized.sh index 22822b3..c8db0a8 100644 --- a/packaging/resources/pkgbuild-git-stable-optimized.sh +++ b/packaging/resources/pkgbuild-git-stable-optimized.sh @@ -45,7 +45,7 @@ build() { esac # compile binary - CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath ./mutn.go + CGO_ENABLED=1 go build -ldflags=\"-s -w\" -trimpath -tags=stxAll ./mutn.go } package() { diff --git a/packaging/resources/release-binaries.sh b/packaging/resources/release-binaries.sh index 86efb86..55cd822 100644 --- a/packaging/resources/release-binaries.sh +++ b/packaging/resources/release-binaries.sh @@ -9,10 +9,10 @@ create_release_binaries() { printf '\nGenerating release binaries...\n' cd .. - GOOS=linux CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-linux-x86_64_v2 -ldflags="-s -w" -trimpath ./mutn.go - GOOS=linux GOARCH=arm64 GOARM64=v8.0 CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.0 -ldflags="-s -w" -trimpath ./mutn.go - GOOS=linux GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.7+crypto -ldflags="-s -w" -trimpath ./mutn.go - GOOS=windows CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-windows-x86_64_v2.exe -ldflags="-s -w" -trimpath ./mutn.go - GOOS=windows GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-windows-arm64v8.7+crypto.exe -ldflags="-s -w" -trimpath ./mutn.go + GOOS=linux CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-linux-x86_64_v2 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go + GOOS=linux GOARCH=arm64 GOARM64=v8.0 CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.0 -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go + GOOS=linux GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-linux-arm64v8.7+crypto -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go + GOOS=windows CGO_ENABLED=0 GOAMD64=v2 go build -o ./packaging/1output/mutn-windows-x86_64_v2.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go + GOOS=windows GOARCH=arm64 GOARM64=v8.7,crypto CGO_ENABLED=0 go build -o ./packaging/1output/mutn-windows-arm64v8.7+crypto.exe -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go cd ./packaging } diff --git a/src/cli/entryReader.go b/src/cli/entryReader.go index 11f150c..11114fa 100644 --- a/src/cli/entryReader.go +++ b/src/cli/entryReader.go @@ -3,7 +3,9 @@ package cli import ( "fmt" "os" + "strings" + "github.com/charmbracelet/glamour" "github.com/rwinkhart/go-boilerplate/back" "github.com/rwinkhart/go-boilerplate/other" "github.com/rwinkhart/libmutton/crypt" @@ -58,8 +60,12 @@ fieldLoop: noteLines = append(noteLines, decryptedEntry[field]) } - // print notes to stdout - renderNote(noteLines) + // render notes as Markdown + r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width)) + markdownNotesString, _ := r.Render(strings.Join(noteLines, "\n")) + + // print the rendered Markdown notes + fmt.Print(markdownNotesString) // break after notes have been printed break fieldLoop diff --git a/src/cli/entryReaderMDBEAN.go b/src/cli/entryReaderMDBEAN.go deleted file mode 100644 index a85b00d..0000000 --- a/src/cli/entryReaderMDBEAN.go +++ /dev/null @@ -1,14 +0,0 @@ -//go:build !noMarkdown && BEAN - -package cli - -import ( - "fmt" - - bean "github.com/Trojan2021/BEAN/render" -) - -// renderNote renders the notes section of an entry (in Markdown) to stdout. -func renderNote(noteLines []string) { - fmt.Println(bean.RenderMarkdown(noteLines, width)) -} diff --git a/src/cli/entryReaderMDDisabled.go b/src/cli/entryReaderMDDisabled.go deleted file mode 100644 index 99b9979..0000000 --- a/src/cli/entryReaderMDDisabled.go +++ /dev/null @@ -1,13 +0,0 @@ -//go:build noMarkdown - -package cli - -import ( - "fmt" - "strings" -) - -// renderNote prints the notes section of an entry to stdout (when Markdown rendering is disabled). -func renderNote(noteLines []string) { - fmt.Print("\n" + strings.Join(noteLines, "\n") + "\n\n") -} diff --git a/src/cli/entryReaderMDGlamour.go b/src/cli/entryReaderMDGlamour.go deleted file mode 100644 index b14e54f..0000000 --- a/src/cli/entryReaderMDGlamour.go +++ /dev/null @@ -1,20 +0,0 @@ -//go:build !noMarkdown && !BEAN - -package cli - -import ( - "fmt" - "strings" - - "github.com/charmbracelet/glamour" -) - -// renderNote renders the notes section of an entry (in Markdown) to stdout. -func renderNote(noteLines []string) { - note := strings.Join(noteLines, "\n") - r, _ := glamour.NewTermRenderer(glamour.WithStylesFromJSONBytes(glamourStyle()), glamour.WithPreservedNewLines(), glamour.WithWordWrap(width)) - markdownNotesString, _ := r.Render(note) - - // print markdown-rendered notes - fmt.Print(markdownNotesString) -} diff --git a/wiki/bugs.md b/wiki/bugs.md index 7bac2b4..f5d29ad 100644 --- a/wiki/bugs.md +++ b/wiki/bugs.md @@ -1,8 +1,7 @@ ## Known Bugs - MUTN CLI - Various Markdown issues resulting from the use of [Glamour](https://github.com/charmbracelet/glamour) - - Note that MUTN is currently using the older Glamour v0.7.0, as v0.8.0 introduced a [line-wrapping regression](https://github.com/charmbracelet/glamour/issues/331) + - Note that MUTN is currently using the older Glamour v0.7.0 (or rather, a custom fork of it), as v0.8.0 introduced a [line-wrapping regression](https://github.com/charmbracelet/glamour/issues/331) - [Odd handling of line breaks](https://github.com/charmbracelet/glamour/issues/84) - [Broken quotes](https://github.com/charmbracelet/glamour/issues/172) (seems related to line break issue) - [Extra blank lines after nested list items](https://github.com/charmbracelet/glamour/issues/102) - [Incorrect wrapping of text in lists](https://github.com/charmbracelet/glamour/issues/56) - - [Excessive binary size and increased program startup time](https://github.com/charmbracelet/glamour/issues/288) \ No newline at end of file diff --git a/wiki/build.md b/wiki/build.md index e80f878..3ca68bf 100644 --- a/wiki/build.md +++ b/wiki/build.md @@ -1,11 +1,9 @@ ## Building Official binaries are stripped of debug info for size and built without CGO (except for distribution packages) for portability, as follows: ``` -CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath ./mutn.go +CGO_ENABLED=0 go build -ldflags="-s -w" -trimpath -tags=stxAll ./mutn.go ``` Additionally, some custom build tags can be used to create different binaries. The following tags are not used in official builds: -- `BEAN`: Creates a binary with the experimental [BEAN](https://github.com/Trojan2021/BEAN) Markdown renderer in place of Glamour -- `noMarkdown`: Creates a binary without Markdown support (much smaller binary size and faster launch time VS Glamour) - `wsl`: Allows creating a Linux binary that can interact with the Windows clipboard (for WSL) - `termux`: Allows creating a Linux binary that can interact with the Termux clipboard (for Android)