From 3dba1d73f6b6a3ac59817b4222f0768dc97e775d Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 23 Jun 2025 15:48:23 -0300 Subject: [PATCH 01/15] feat: use fang --- go.mod | 9 ++++++--- go.sum | 10 ++++++++-- main.go | 24 +++++++----------------- man_cmd.go | 29 ----------------------------- 4 files changed, 21 insertions(+), 51 deletions(-) delete mode 100644 man_cmd.go diff --git a/go.mod b/go.mod index 97cfc60..b2ce8e5 100644 --- a/go.mod +++ b/go.mod @@ -9,6 +9,7 @@ require ( github.com/caarlos0/env/v11 v11.3.1 github.com/charmbracelet/bubbles v0.21.0 github.com/charmbracelet/bubbletea v1.3.5 + github.com/charmbracelet/fang v0.2.0 github.com/charmbracelet/glamour v0.10.0 github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 github.com/charmbracelet/log v0.4.2 @@ -19,9 +20,7 @@ require ( github.com/mitchellh/go-homedir v1.1.0 github.com/muesli/gitcha v0.3.0 github.com/muesli/go-app-paths v0.2.2 - github.com/muesli/mango-cobra v1.2.0 github.com/muesli/reflow v0.3.0 - github.com/muesli/roff v0.1.0 github.com/muesli/termenv v0.16.0 github.com/sahilm/fuzzy v0.1.1 github.com/spf13/cobra v1.9.1 @@ -35,9 +34,11 @@ require ( github.com/alecthomas/chroma/v2 v2.14.0 // indirect github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect github.com/aymerick/douceur v0.2.0 // indirect - github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect + github.com/charmbracelet/colorprofile v0.3.0 // indirect + github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1 // indirect github.com/charmbracelet/x/ansi v0.8.0 // indirect github.com/charmbracelet/x/cellbuf v0.0.13 // indirect + github.com/charmbracelet/x/exp/charmtone v0.0.0-20250603201427-c31516f43444 // indirect github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf // indirect github.com/charmbracelet/x/term v0.2.1 // indirect github.com/dlclark/regexp2 v1.11.0 // indirect @@ -53,7 +54,9 @@ require ( github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect github.com/muesli/cancelreader v0.2.2 // indirect github.com/muesli/mango v0.1.0 // indirect + github.com/muesli/mango-cobra v1.2.0 // indirect github.com/muesli/mango-pflag v0.1.0 // indirect + github.com/muesli/roff v0.1.0 // indirect github.com/pelletier/go-toml/v2 v2.2.3 // indirect github.com/rivo/uniseg v0.4.7 // indirect github.com/rogpeppe/go-internal v1.12.0 // indirect diff --git a/go.sum b/go.sum index a45e752..1585ca7 100644 --- a/go.sum +++ b/go.sum @@ -18,12 +18,16 @@ github.com/charmbracelet/bubbles v0.21.0 h1:9TdC97SdRVg/1aaXNVWfFH3nnLAwOXr8Fn6u github.com/charmbracelet/bubbles v0.21.0/go.mod h1:HF+v6QUR4HkEpz62dx7ym2xc71/KBHg+zKwJtMw+qtg= github.com/charmbracelet/bubbletea v1.3.5 h1:JAMNLTbqMOhSwoELIr0qyP4VidFq72/6E9j7HHmRKQc= github.com/charmbracelet/bubbletea v1.3.5/go.mod h1:TkCnmH+aBd4LrXhXcqrKiYwRs7qyQx5rBgH5fVY3v54= -github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs= -github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk= +github.com/charmbracelet/colorprofile v0.3.0 h1:KtLh9uuu1RCt+Hml4s6Hz+kB1PfV3wi++1h5ia65yKQ= +github.com/charmbracelet/colorprofile v0.3.0/go.mod h1:oHJ340RS2nmG1zRGPmhJKJ/jf4FPNNk0P39/wBPA1G0= +github.com/charmbracelet/fang v0.2.0 h1:F2sK2Zjy9kRYz/xUSF1o89DNj2BHKpxVKT7TA21KZi0= +github.com/charmbracelet/fang v0.2.0/go.mod h1:TPpME1GkB6/4uR4wXmPnugTCkqRLgZkWSH+aMds6454= github.com/charmbracelet/glamour v0.10.0 h1:MtZvfwsYCx8jEPFJm3rIBFIMZUfUJ765oX8V6kXldcY= github.com/charmbracelet/glamour v0.10.0/go.mod h1:f+uf+I/ChNmqo087elLnVdCiVgjSKWuXa/l6NU2ndYk= github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834 h1:ZR7e0ro+SZZiIZD7msJyA+NjkCNNavuiPBLgerbOziE= github.com/charmbracelet/lipgloss v1.1.1-0.20250404203927-76690c660834/go.mod h1:aKC/t2arECF6rNOnaKaVU6y4t4ZeHQzqfxedE/VkVhA= +github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1 h1:D9AJJuYTN5pvz6mpIGO1ijLKpfTYSHOtKGgwoTQ4Gog= +github.com/charmbracelet/lipgloss/v2 v2.0.0-beta.1/go.mod h1:tRlx/Hu0lo/j9viunCN2H+Ze6JrmdjQlXUQvvArgaOc= github.com/charmbracelet/log v0.4.2 h1:hYt8Qj6a8yLnvR+h7MwsJv/XvmBJXiueUcI3cIxsyig= github.com/charmbracelet/log v0.4.2/go.mod h1:qifHGX/tc7eluv2R6pWIpyHDDrrb/AG71Pf2ysQu5nw= github.com/charmbracelet/x/ansi v0.8.0 h1:9GTq3xq9caJW8ZrBTe0LIe2fvfLR/bYXKTx2llXn7xE= @@ -32,6 +36,8 @@ github.com/charmbracelet/x/cellbuf v0.0.13 h1:/KBBKHuVRbq1lYx5BzEHBAFBP8VcQzJejZ github.com/charmbracelet/x/cellbuf v0.0.13/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs= github.com/charmbracelet/x/editor v0.1.0 h1:p69/dpvlwRTs9uYiPeAWruwsHqTFzHhTvQOd/WVSX98= github.com/charmbracelet/x/editor v0.1.0/go.mod h1:oivrEbcP/AYt/Hpvk5pwDXXrQ933gQS6UzL6fxqAGSA= +github.com/charmbracelet/x/exp/charmtone v0.0.0-20250603201427-c31516f43444 h1:IJDiTgVE56gkAGfq0lBEloWgkXMk4hl/bmuPoicI4R0= +github.com/charmbracelet/x/exp/charmtone v0.0.0-20250603201427-c31516f43444/go.mod h1:T9jr8CzFpjhFVHjNjKwbAD7KwBNyFnj2pntAO7F2zw0= github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payRxjMjKgx2PaCWLZ4p3ro9y97+TVLZNaRZgJwSVDQ= github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U= github.com/charmbracelet/x/exp/slice v0.0.0-20250327172914-2fdc97757edf h1:rLG0Yb6MQSDKdB52aGX55JT1oi0P0Kuaj7wi1bLUpnI= diff --git a/main.go b/main.go index b0d7a77..44be332 100644 --- a/main.go +++ b/main.go @@ -2,6 +2,7 @@ package main import ( + "context" "errors" "fmt" "io" @@ -14,6 +15,7 @@ import ( "strings" "github.com/caarlos0/env/v11" + "github.com/charmbracelet/fang" "github.com/charmbracelet/glamour" "github.com/charmbracelet/glamour/styles" "github.com/charmbracelet/glow/v2/ui" @@ -44,11 +46,9 @@ var ( mouse bool rootCmd = &cobra.Command{ - Use: "glow [SOURCE|DIR]", - Short: "Render markdown on the CLI, with pizzazz!", - Long: paragraph( - fmt.Sprintf("\nRender markdown on the CLI, %s!", keyword("with pizzazz")), - ), + Use: "glow [SOURCE|DIR]", + Short: "Render markdown on the CLI, with pizzazz!", + Long: fmt.Sprintf("Render markdown on the CLI, %s!", keyword("with pizzazz")), SilenceErrors: false, SilenceUsage: true, TraverseChildren: true, @@ -374,7 +374,7 @@ func main() { fmt.Println(err) os.Exit(1) } - if err := rootCmd.Execute(); err != nil { + if err := fang.Execute(context.Background(), rootCmd); err != nil { _ = closer() os.Exit(1) } @@ -383,16 +383,6 @@ func main() { func init() { tryLoadConfigFromDefaultPlaces() - if len(CommitSHA) >= 7 { - vt := rootCmd.VersionTemplate() - rootCmd.SetVersionTemplate(vt[:len(vt)-1] + " (" + CommitSHA[0:7] + ")\n") - } - if Version == "" { - Version = "unknown (built from source)" - } - rootCmd.Version = Version - rootCmd.InitDefaultCompletionCmd() - // "Glow Classic" cli arguments rootCmd.PersistentFlags().StringVar(&configFile, "config", "", fmt.Sprintf("config file (default %s)", viper.GetViper().ConfigFileUsed())) rootCmd.Flags().BoolVarP(&pager, "pager", "p", false, "display with pager") @@ -420,7 +410,7 @@ func init() { viper.SetDefault("width", 0) viper.SetDefault("all", true) - rootCmd.AddCommand(configCmd, manCmd) + rootCmd.AddCommand(configCmd) } func tryLoadConfigFromDefaultPlaces() { diff --git a/man_cmd.go b/man_cmd.go deleted file mode 100644 index a179ef7..0000000 --- a/man_cmd.go +++ /dev/null @@ -1,29 +0,0 @@ -package main - -import ( - "fmt" - "os" - - mcobra "github.com/muesli/mango-cobra" - "github.com/muesli/roff" - "github.com/spf13/cobra" -) - -var manCmd = &cobra.Command{ - Use: "man", - Short: "Generates manpages", - SilenceUsage: true, - DisableFlagsInUseLine: true, - Hidden: true, - Args: cobra.NoArgs, - RunE: func(*cobra.Command, []string) error { - manPage, err := mcobra.NewManPage(1, rootCmd) - if err != nil { - return fmt.Errorf("unable to instantiate man page: %w", err) - } - if _, err := fmt.Fprint(os.Stdout, manPage.Build(roff.NewDocument())); err != nil { - return fmt.Errorf("unable to build man page: %w", err) - } - return nil - }, -} From 45cacb4b3103240e87428a341377847915d21d74 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 30 Jun 2025 08:24:29 -0300 Subject: [PATCH 02/15] fix: use ctx Signed-off-by: Carlos Alexandro Becker --- main.go | 14 ++++++-------- ui/ui.go | 5 +++-- 2 files changed, 9 insertions(+), 10 deletions(-) diff --git a/main.go b/main.go index 44be332..dd3bb7c 100644 --- a/main.go +++ b/main.go @@ -49,8 +49,6 @@ var ( Use: "glow [SOURCE|DIR]", Short: "Render markdown on the CLI, with pizzazz!", Long: fmt.Sprintf("Render markdown on the CLI, %s!", keyword("with pizzazz")), - SilenceErrors: false, - SilenceUsage: true, TraverseChildren: true, Args: cobra.MaximumNArgs(1), ValidArgsFunction: func(*cobra.Command, []string, string) ([]string, cobra.ShellCompDirective) { @@ -233,7 +231,7 @@ func execute(cmd *cobra.Command, args []string) error { switch len(args) { // TUI running on cwd case 0: - return runTUI("", "") + return runTUI(cmd.Context(), "", "") // TUI with possible dir argument case 1: @@ -243,7 +241,7 @@ func execute(cmd *cobra.Command, args []string) error { if err == nil && info.IsDir() { p, err := filepath.Abs(args[0]) if err == nil { - return runTUI(p, "") + return runTUI(cmd.Context(), p, "") } } fallthrough @@ -320,7 +318,7 @@ func executeCLI(cmd *cobra.Command, src *source, w io.Writer) error { } pa := strings.Split(pagerCmd, " ") - c := exec.Command(pa[0], pa[1:]...) //nolint:gosec + c := exec.CommandContext(cmd.Context(), pa[0], pa[1:]...) //nolint:gosec c.Stdin = strings.NewReader(out) c.Stdout = os.Stdout if err := c.Run(); err != nil { @@ -332,7 +330,7 @@ func executeCLI(cmd *cobra.Command, src *source, w io.Writer) error { if !isURL(src.URL) { path = src.URL } - return runTUI(path, content) + return runTUI(cmd.Context(), path, content) default: if _, err = fmt.Fprint(w, out); err != nil { return fmt.Errorf("unable to write to writer: %w", err) @@ -341,7 +339,7 @@ func executeCLI(cmd *cobra.Command, src *source, w io.Writer) error { } } -func runTUI(path string, content string) error { +func runTUI(ctx context.Context, path string, content string) error { // Read environment to get debugging stuff cfg, err := env.ParseAs[ui.Config]() if err != nil { @@ -361,7 +359,7 @@ func runTUI(path string, content string) error { cfg.PreserveNewLines = preserveNewLines // Run Bubble Tea program - if _, err := ui.NewProgram(cfg, content).Run(); err != nil { + if _, err := ui.NewProgram(ctx, cfg, content).Run(); err != nil { return fmt.Errorf("unable to run tui program: %w", err) } diff --git a/ui/ui.go b/ui/ui.go index 3537d3f..23f3ad8 100644 --- a/ui/ui.go +++ b/ui/ui.go @@ -2,6 +2,7 @@ package ui import ( + "context" "fmt" "os" "path/filepath" @@ -30,7 +31,7 @@ var ( ) // NewProgram returns a new Tea program. -func NewProgram(cfg Config, content string) *tea.Program { +func NewProgram(ctx context.Context, cfg Config, content string) *tea.Program { log.Debug( "Starting glow", "high_perf_pager", @@ -40,7 +41,7 @@ func NewProgram(cfg Config, content string) *tea.Program { ) config = cfg - opts := []tea.ProgramOption{tea.WithAltScreen()} + opts := []tea.ProgramOption{tea.WithAltScreen(), tea.WithContext(ctx)} if cfg.EnableMouse { opts = append(opts, tea.WithMouseCellMotion()) } From 7ec9d79229cb667b20145192b4335572ed0dee26 Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Mon, 30 Jun 2025 08:38:18 -0300 Subject: [PATCH 03/15] fix: use context in http calls --- github.go | 21 ++++++++++++++------- gitlab.go | 21 ++++++++++++++------- main.go | 12 ++++++++---- url.go | 11 ++++++----- url_test.go | 7 +++++-- 5 files changed, 47 insertions(+), 25 deletions(-) diff --git a/github.go b/github.go index fe862e3..7878fdf 100644 --- a/github.go +++ b/github.go @@ -1,6 +1,7 @@ package main import ( + "context" "encoding/json" "errors" "fmt" @@ -11,7 +12,7 @@ import ( ) // findGitHubREADME tries to find the correct README filename in a repository using GitHub API. -func findGitHubREADME(u *url.URL) (*source, error) { +func findGitHubREADME(ctx context.Context, u *url.URL) (*source, error) { owner, repo, ok := strings.Cut(strings.TrimPrefix(u.Path, "/"), "/") if !ok { return nil, fmt.Errorf("invalid url: %s", u.String()) @@ -23,12 +24,15 @@ func findGitHubREADME(u *url.URL) (*source, error) { apiURL := fmt.Sprintf("https://api.%s/repos/%s/%s/readme", u.Hostname(), owner, repo) - //nolint:bodyclose - // it is closed on the caller - res, err := http.Get(apiURL) //nolint: gosec,noctx + req, err := http.NewRequestWithContext(ctx, http.MethodGet, apiURL, nil) + if err != nil { + return nil, fmt.Errorf("unable to create request: %w", err) + } + res, err := http.DefaultClient.Do(req) if err != nil { return nil, fmt.Errorf("unable to get url: %w", err) } + defer res.Body.Close() //nolint:errcheck body, err := io.ReadAll(res.Body) if err != nil { @@ -41,9 +45,12 @@ func findGitHubREADME(u *url.URL) (*source, error) { } if res.StatusCode == http.StatusOK { - //nolint:bodyclose - // it is closed on the caller - resp, err := http.Get(result.DownloadURL) //nolint: noctx + // consumer of the source is responsible for closing the ReadCloser. + req, err := http.NewRequestWithContext(ctx, http.MethodGet, result.DownloadURL, nil) + if err != nil { + return nil, fmt.Errorf("unable to create request: %w", err) + } + resp, err := http.DefaultClient.Do(req) //nolint:bodyclose if err != nil { return nil, fmt.Errorf("unable to get url: %w", err) } diff --git a/gitlab.go b/gitlab.go index 68256be..d2915ef 100644 --- a/gitlab.go +++ b/gitlab.go @@ -1,6 +1,7 @@ package main import ( + "context" "encoding/json" "errors" "fmt" @@ -11,7 +12,7 @@ import ( ) // findGitLabREADME tries to find the correct README filename in a repository using GitLab API. -func findGitLabREADME(u *url.URL) (*source, error) { +func findGitLabREADME(ctx context.Context, u *url.URL) (*source, error) { owner, repo, ok := strings.Cut(strings.TrimPrefix(u.Path, "/"), "/") if !ok { return nil, fmt.Errorf("invalid url: %s", u.String()) @@ -25,12 +26,15 @@ func findGitLabREADME(u *url.URL) (*source, error) { apiURL := fmt.Sprintf("https://%s/api/v4/projects/%s", u.Hostname(), projectPath) - //nolint:bodyclose - // it is closed on the caller - res, err := http.Get(apiURL) //nolint: gosec,noctx + req, err := http.NewRequestWithContext(ctx, http.MethodGet, apiURL, nil) + if err != nil { + return nil, fmt.Errorf("unable to create request: %w", err) + } + res, err := http.DefaultClient.Do(req) if err != nil { return nil, fmt.Errorf("unable to get url: %w", err) } + defer res.Body.Close() //nolint:errcheck body, err := io.ReadAll(res.Body) if err != nil { @@ -45,9 +49,12 @@ func findGitLabREADME(u *url.URL) (*source, error) { readmeRawURL := strings.ReplaceAll(result.ReadmeURL, "blob", "raw") if res.StatusCode == http.StatusOK { - //nolint:bodyclose - // it is closed on the caller - resp, err := http.Get(readmeRawURL) //nolint: gosec,noctx + // consumer of the source is responsible for closing the ReadCloser. + req, err := http.NewRequestWithContext(ctx, http.MethodGet, readmeRawURL, nil) + if err != nil { + return nil, fmt.Errorf("unable to create request: %w", err) + } + resp, err := http.DefaultClient.Do(req) //nolint:bodyclose if err != nil { return nil, fmt.Errorf("unable to get url: %w", err) } diff --git a/main.go b/main.go index dd3bb7c..2b4000c 100644 --- a/main.go +++ b/main.go @@ -68,14 +68,14 @@ type source struct { } // sourceFromArg parses an argument and creates a readable source for it. -func sourceFromArg(arg string) (*source, error) { +func sourceFromArg(ctx context.Context, arg string) (*source, error) { // from stdin if arg == "-" { return &source{reader: os.Stdin}, nil } // a GitHub or GitLab URL (even without the protocol): - src, err := readmeURL(arg) + src, err := readmeURL(ctx, arg) if src != nil && err == nil { // if there's an error, try next methods... return src, nil @@ -88,7 +88,11 @@ func sourceFromArg(arg string) (*source, error) { return nil, fmt.Errorf("%s is not a supported protocol", u.Scheme) } // consumer of the source is responsible for closing the ReadCloser. - resp, err := http.Get(u.String()) //nolint: noctx,bodyclose + req, err := http.NewRequestWithContext(ctx, http.MethodGet, u.String(), nil) + if err != nil { + return nil, fmt.Errorf("unable to create request: %w", err) + } + resp, err := http.DefaultClient.Do(req) //nolint:bodyclose if err != nil { return nil, fmt.Errorf("unable to get url: %w", err) } @@ -260,7 +264,7 @@ func execute(cmd *cobra.Command, args []string) error { func executeArg(cmd *cobra.Command, arg string, w io.Writer) error { // create an io.Reader from the markdown source in cli-args - src, err := sourceFromArg(arg) + src, err := sourceFromArg(cmd.Context(), arg) if err != nil { return err } diff --git a/url.go b/url.go index f716681..d92e70a 100644 --- a/url.go +++ b/url.go @@ -1,6 +1,7 @@ package main import ( + "context" "fmt" "net/url" "strings" @@ -26,16 +27,16 @@ func init() { }) } -func readmeURL(path string) (*source, error) { +func readmeURL(ctx context.Context, path string) (*source, error) { switch { case strings.HasPrefix(path, protoGithub): if u := githubReadmeURL(path); u != nil { - return readmeURL(u.String()) + return readmeURL(ctx, u.String()) } return nil, nil case strings.HasPrefix(path, protoGitlab): if u := gitlabReadmeURL(path); u != nil { - return readmeURL(u.String()) + return readmeURL(ctx, u.String()) } return nil, nil } @@ -50,9 +51,9 @@ func readmeURL(path string) (*source, error) { switch { case u.Hostname() == githubURL.Hostname(): - return findGitHubREADME(u) + return findGitHubREADME(ctx, u) case u.Hostname() == gitlabURL.Hostname(): - return findGitLabREADME(u) + return findGitLabREADME(ctx, u) } return nil, nil diff --git a/url_test.go b/url_test.go index 9683892..a23c1b1 100644 --- a/url_test.go +++ b/url_test.go @@ -1,6 +1,9 @@ package main -import "testing" +import ( + "context" + "testing" +) func TestURLParser(t *testing.T) { for path, url := range map[string]string{ @@ -15,7 +18,7 @@ func TestURLParser(t *testing.T) { } { t.Run(path, func(t *testing.T) { t.Skip("test uses network, sometimes fails for no reason") - got, err := readmeURL(path) + got, err := readmeURL(context.Background(), path) if err != nil { t.Fatalf("expected no error, got %v", err) } From 30efab4f4610b7ed2fbeb8bacf3a22ab1e82d66d Mon Sep 17 00:00:00 2001 From: Carlos Alexandro Becker Date: Tue, 21 Oct 2025 09:56:51 -0300 Subject: [PATCH 04/15] test: update Signed-off-by: Carlos Alexandro Becker --- url_test.go | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/url_test.go b/url_test.go index a23c1b1..8517f65 100644 --- a/url_test.go +++ b/url_test.go @@ -1,9 +1,6 @@ package main -import ( - "context" - "testing" -) +import "testing" func TestURLParser(t *testing.T) { for path, url := range map[string]string{ @@ -18,7 +15,7 @@ func TestURLParser(t *testing.T) { } { t.Run(path, func(t *testing.T) { t.Skip("test uses network, sometimes fails for no reason") - got, err := readmeURL(context.Background(), path) + got, err := readmeURL(t.Context(), path) if err != nil { t.Fatalf("expected no error, got %v", err) } From 07d4e1de3fe693946d997835a4dfb9c33bec3be6 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 11:33:09 +0000 Subject: [PATCH 05/15] chore(deps): bump golangci/golangci-lint-action in the all group (#843) Bumps the all group with 1 update: [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action). Updates `golangci/golangci-lint-action` from 8.0.0 to 9.0.0 - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v8.0.0...v9.0.0) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-version: 9.0.0 dependency-type: direct:production update-type: version-update:semver-major dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index bcfb79c..b89cf68 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v5 - name: golangci-lint - uses: golangci/golangci-lint-action@v8.0.0 + uses: golangci/golangci-lint-action@v9.0.0 with: # Optional: golangci-lint command line arguments. args: --issues-exit-code=0 From dbf59aafa9762c9df28c3f5f1569a35cfa1b5e62 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 10 Nov 2025 11:35:26 +0000 Subject: [PATCH 06/15] chore(deps): bump golang.org/x/sys in the all group (#844) Bumps the all group with 1 update: [golang.org/x/sys](https://github.com/golang/sys). Updates `golang.org/x/sys` from 0.37.0 to 0.38.0 - [Commits](https://github.com/golang/sys/compare/v0.37.0...v0.38.0) --- updated-dependencies: - dependency-name: golang.org/x/sys dependency-version: 0.38.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 2 +- go.sum | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/go.mod b/go.mod index 4212231..61528a0 100644 --- a/go.mod +++ b/go.mod @@ -26,7 +26,7 @@ require ( github.com/sahilm/fuzzy v0.1.1 github.com/spf13/cobra v1.10.1 github.com/spf13/viper v1.21.0 - golang.org/x/sys v0.37.0 + golang.org/x/sys v0.38.0 golang.org/x/term v0.36.0 golang.org/x/text v0.30.0 ) diff --git a/go.sum b/go.sum index 782d0de..0004fd0 100644 --- a/go.sum +++ b/go.sum @@ -159,8 +159,8 @@ golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.37.0 h1:fdNQudmxPjkdUTPnLn5mdQv7Zwvbvpaxqs831goi9kQ= -golang.org/x/sys v0.37.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= +golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q= golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss= golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= From ba37804fd57d82fdea1e2a4275884a76f27c1d8f Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 17 Nov 2025 10:43:05 +0000 Subject: [PATCH 07/15] chore(deps): bump the all group with 2 updates (#847) Bumps the all group with 2 updates: [golang.org/x/term](https://github.com/golang/term) and [golang.org/x/text](https://github.com/golang/text). Updates `golang.org/x/term` from 0.36.0 to 0.37.0 - [Commits](https://github.com/golang/term/compare/v0.36.0...v0.37.0) Updates `golang.org/x/text` from 0.30.0 to 0.31.0 - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.30.0...v0.31.0) --- updated-dependencies: - dependency-name: golang.org/x/term dependency-version: 0.37.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all - dependency-name: golang.org/x/text dependency-version: 0.31.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 4 ++-- go.sum | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/go.mod b/go.mod index 61528a0..70f7087 100644 --- a/go.mod +++ b/go.mod @@ -27,8 +27,8 @@ require ( github.com/spf13/cobra v1.10.1 github.com/spf13/viper v1.21.0 golang.org/x/sys v0.38.0 - golang.org/x/term v0.36.0 - golang.org/x/text v0.30.0 + golang.org/x/term v0.37.0 + golang.org/x/text v0.31.0 ) require ( diff --git a/go.sum b/go.sum index 0004fd0..c93d4b5 100644 --- a/go.sum +++ b/go.sum @@ -161,10 +161,10 @@ golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/term v0.36.0 h1:zMPR+aF8gfksFprF/Nc/rd1wRS1EI6nDBGyWAvDzx2Q= -golang.org/x/term v0.36.0/go.mod h1:Qu394IJq6V6dCBRgwqshf3mPF85AqzYEzofzRdZkWss= -golang.org/x/text v0.30.0 h1:yznKA/E9zq54KzlzBEAWn1NXSQ8DIp/NYMy88xJjl4k= -golang.org/x/text v0.30.0/go.mod h1:yDdHFIX9t+tORqspjENWgzaCVXgk0yYnYuSZ8UzzBVM= +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/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= +golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From a861530349279f2bf7d8bdbc41e22615c2f6ff79 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 24 Nov 2025 11:33:59 +0000 Subject: [PATCH 08/15] chore(deps): bump the all group with 2 updates (#848) Bumps the all group with 2 updates: [actions/checkout](https://github.com/actions/checkout) and [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action). Updates `actions/checkout` from 5 to 6 - [Release notes](https://github.com/actions/checkout/releases) - [Changelog](https://github.com/actions/checkout/blob/main/CHANGELOG.md) - [Commits](https://github.com/actions/checkout/compare/v5...v6) Updates `golangci/golangci-lint-action` from 9.0.0 to 9.1.0 - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v9.0.0...v9.1.0) --- updated-dependencies: - dependency-name: actions/checkout dependency-version: '6' dependency-type: direct:production update-type: version-update:semver-major dependency-group: all - dependency-name: golangci/golangci-lint-action dependency-version: 9.1.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/coverage.yml | 2 +- .github/workflows/lint.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 1105fa2..7fbd40b 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -8,7 +8,7 @@ jobs: GO111MODULE: "on" steps: - name: Checkout code - uses: actions/checkout@v5 + uses: actions/checkout@v6 - name: Install Go uses: actions/setup-go@v6 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b89cf68..568f683 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,9 +8,9 @@ jobs: name: lint runs-on: ubuntu-latest steps: - - uses: actions/checkout@v5 + - uses: actions/checkout@v6 - name: golangci-lint - uses: golangci/golangci-lint-action@v9.0.0 + uses: golangci/golangci-lint-action@v9.1.0 with: # Optional: golangci-lint command line arguments. args: --issues-exit-code=0 From 7903cdbc5fd2b7449b853e4d4e88e9df38586e72 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 8 Dec 2025 10:05:33 +0000 Subject: [PATCH 09/15] chore(deps): bump golangci/golangci-lint-action in the all group (#854) Bumps the all group with 1 update: [golangci/golangci-lint-action](https://github.com/golangci/golangci-lint-action). Updates `golangci/golangci-lint-action` from 9.1.0 to 9.2.0 - [Release notes](https://github.com/golangci/golangci-lint-action/releases) - [Commits](https://github.com/golangci/golangci-lint-action/compare/v9.1.0...v9.2.0) --- updated-dependencies: - dependency-name: golangci/golangci-lint-action dependency-version: 9.2.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 568f683..1e21125 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -10,7 +10,7 @@ jobs: steps: - uses: actions/checkout@v6 - name: golangci-lint - uses: golangci/golangci-lint-action@v9.1.0 + uses: golangci/golangci-lint-action@v9.2.0 with: # Optional: golangci-lint command line arguments. args: --issues-exit-code=0 From 752de97c5a331af0eed0c7b417462621bffa533e Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 15 Dec 2025 10:08:33 +0000 Subject: [PATCH 10/15] chore(deps): bump the all group across 1 directory with 4 updates (#857) Bumps the all group with 4 updates in the / directory: [github.com/spf13/cobra](https://github.com/spf13/cobra), [golang.org/x/sys](https://github.com/golang/sys), [golang.org/x/term](https://github.com/golang/term) and [golang.org/x/text](https://github.com/golang/text). Updates `github.com/spf13/cobra` from 1.10.1 to 1.10.2 - [Release notes](https://github.com/spf13/cobra/releases) - [Commits](https://github.com/spf13/cobra/compare/v1.10.1...v1.10.2) Updates `golang.org/x/sys` from 0.38.0 to 0.39.0 - [Commits](https://github.com/golang/sys/compare/v0.38.0...v0.39.0) Updates `golang.org/x/term` from 0.37.0 to 0.38.0 - [Commits](https://github.com/golang/term/compare/v0.37.0...v0.38.0) Updates `golang.org/x/text` from 0.31.0 to 0.32.0 - [Release notes](https://github.com/golang/text/releases) - [Commits](https://github.com/golang/text/compare/v0.31.0...v0.32.0) --- updated-dependencies: - dependency-name: github.com/spf13/cobra dependency-version: 1.10.2 dependency-type: direct:production update-type: version-update:semver-patch dependency-group: all - dependency-name: golang.org/x/sys dependency-version: 0.39.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all - dependency-name: golang.org/x/term dependency-version: 0.38.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all - dependency-name: golang.org/x/text dependency-version: 0.32.0 dependency-type: direct:production update-type: version-update:semver-minor dependency-group: all ... Signed-off-by: dependabot[bot] Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> --- go.mod | 8 ++++---- go.sum | 16 ++++++++-------- 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/go.mod b/go.mod index 70f7087..55995bf 100644 --- a/go.mod +++ b/go.mod @@ -24,11 +24,11 @@ require ( github.com/muesli/roff v0.1.0 github.com/muesli/termenv v0.16.0 github.com/sahilm/fuzzy v0.1.1 - github.com/spf13/cobra v1.10.1 + github.com/spf13/cobra v1.10.2 github.com/spf13/viper v1.21.0 - golang.org/x/sys v0.38.0 - golang.org/x/term v0.37.0 - golang.org/x/text v0.31.0 + golang.org/x/sys v0.39.0 + golang.org/x/term v0.38.0 + golang.org/x/text v0.32.0 ) require ( diff --git a/go.sum b/go.sum index c93d4b5..f2609d4 100644 --- a/go.sum +++ b/go.sum @@ -131,8 +131,8 @@ github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I= github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg= github.com/spf13/cast v1.10.0 h1:h2x0u2shc1QuLHfxi+cTJvs30+ZAHOGRic8uyGTDWxY= github.com/spf13/cast v1.10.0/go.mod h1:jNfB8QC9IA6ZuY2ZjDp0KtFO2LZZlg4S/7bzP6qqeHo= -github.com/spf13/cobra v1.10.1 h1:lJeBwCfmrnXthfAupyUTzJ/J4Nc1RsHC/mSRU2dll/s= -github.com/spf13/cobra v1.10.1/go.mod h1:7SmJGaTHFVBY0jW4NXGluQoLvhqFQM+6XSKD+P4XaB0= +github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU= +github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4= github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk= github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg= @@ -159,12 +159,12 @@ golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.38.0 h1:3yZWxaJjBmCWXqhN1qh02AkOnCQ1poK6oF+a7xWL6Gc= -golang.org/x/sys v0.38.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -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/text v0.31.0 h1:aC8ghyu4JhP8VojJ2lEHBnochRno1sgL6nEi9WGFGMM= -golang.org/x/text v0.31.0/go.mod h1:tKRAlv61yKIjGGHX/4tP1LTbc13YSec1pxVEWXzfoeM= +golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= +golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= +golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q= +golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= +golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= +golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= From fac0fb456d9ff873121fab10595a46a72f3a01ba Mon Sep 17 00:00:00 2001 From: Matt Van Horn Date: Thu, 9 Apr 2026 12:12:10 -0700 Subject: [PATCH 11/15] fix: use `shell.Fields` to parse `$PAGER` command (#922) Replace cmd/sh shell invocation with shell.Fields from mvdan.cc/sh. This properly handles paths with spaces on all platforms without shelling out. Fixes #385 --- go.mod | 10 ++++------ go.sum | 20 ++++++++++++-------- main.go | 9 +++++++-- 3 files changed, 23 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 55995bf..ad021fa 100644 --- a/go.mod +++ b/go.mod @@ -1,8 +1,6 @@ module github.com/charmbracelet/glow/v2 -go 1.24.0 - -toolchain go1.24.1 +go 1.25.0 require ( github.com/atotto/clipboard v0.1.4 @@ -26,9 +24,10 @@ require ( github.com/sahilm/fuzzy v0.1.1 github.com/spf13/cobra v1.10.2 github.com/spf13/viper v1.21.0 - golang.org/x/sys v0.39.0 - golang.org/x/term v0.38.0 + golang.org/x/sys v0.42.0 + golang.org/x/term v0.41.0 golang.org/x/text v0.32.0 + mvdan.cc/sh/v3 v3.13.1 ) require ( @@ -57,7 +56,6 @@ require ( github.com/muesli/mango-pflag v0.1.0 // indirect github.com/pelletier/go-toml/v2 v2.2.4 // indirect github.com/rivo/uniseg v0.4.7 // indirect - github.com/rogpeppe/go-internal v1.12.0 // indirect github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94 // indirect github.com/sagikazarmark/locafero v0.11.0 // indirect github.com/sourcegraph/conc v0.3.1-0.20240121214520-5f936abd7ae8 // indirect diff --git a/go.sum b/go.sum index f2609d4..9880660 100644 --- a/go.sum +++ b/go.sum @@ -56,10 +56,12 @@ github.com/fsnotify/fsnotify v1.9.0 h1:2Ml+OJNzbYCTzsxtv8vKSFD9PbJjmhYF14k/jKC7S github.com/fsnotify/fsnotify v1.9.0/go.mod h1:8jBTzvmWwFyi3Pb8djgCCO5IBqzKJ/Jwo8TRcHyHii0= github.com/go-logfmt/logfmt v0.6.0 h1:wGYYu3uicYdqXVgoYbvnkrPVXkuLM1p1ifugDMEdRi4= github.com/go-logfmt/logfmt v0.6.0/go.mod h1:WYhtIu8zTZfxdn5+rREduYbwxfcBr/Vr6KEVveWlfTs= +github.com/go-quicktest/qt v1.101.0 h1:O1K29Txy5P2OK0dGo59b7b0LR6wKfIhttaAhHUyn7eI= +github.com/go-quicktest/qt v1.101.0/go.mod h1:14Bz/f7NwaXPtdYEgzsx46kqSxVwTbzVZsDC26tQJow= github.com/go-viper/mapstructure/v2 v2.4.0 h1:EBsztssimR/CONLSZZ04E8qAkxNYq4Qp9LvH92wZUgs= github.com/go-viper/mapstructure/v2 v2.4.0/go.mod h1:oJDH3BJKyqBA2TXFhDsKDGDTlndYOZ6rGS0BRZIxGhM= -github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= -github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/google/go-cmp v0.7.0 h1:wk8382ETsv4JYUZwIsn6YpYiWiBsYLSJiTsyBybVuN8= +github.com/google/go-cmp v0.7.0/go.mod h1:pXiqmnSA92OHEEa9HXL2W4E7lf9JzCmGVUdgjX3N/iU= github.com/gorilla/css v1.0.1 h1:ntNaBIghp6JmvWnxbZKANoLyuXTPZ4cAMlo6RyhlbO8= github.com/gorilla/css v1.0.1/go.mod h1:BvnYkspnSzMmwRK+b8/xgNPLiIuNZr6vbZBTPQ2A3b0= github.com/hexops/gotextdiff v1.0.3 h1:gitA9+qJrrTCsiCl7+kh75nPqQt1cx4ZkudSTLoUqJM= @@ -116,8 +118,8 @@ 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/rogpeppe/go-internal v1.12.0 h1:exVL4IDcn6na9z1rAb56Vxr+CgyK3nn3O+epU5NdKM8= -github.com/rogpeppe/go-internal v1.12.0/go.mod h1:E+RYuTGaKKdloAfM02xzb0FW3Paa99yedzYV+kq4uf4= +github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0tI/otEQ= +github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94 h1:G04eS0JkAIVZfaJLjla9dNxkJCPiKIGZlw9AfOhzOD0= github.com/sabhiram/go-gitignore v0.0.0-20180611051255-d3107576ba94/go.mod h1:b18R55ulyQ/h3RaWyloPyER7fWQVZvimKKhnI5OfrJQ= @@ -159,10 +161,10 @@ golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.39.0 h1:CvCKL8MeisomCi6qNZ+wbb0DN9E5AATixKsvNtMoMFk= -golang.org/x/sys v0.39.0/go.mod h1:OgkHotnGiDImocRcuBABYBEXf8A9a87e/uXjp9XT3ks= -golang.org/x/term v0.38.0 h1:PQ5pkm/rLO6HnxFR7N2lJHOZX6Kez5Y1gDSJla6jo7Q= -golang.org/x/term v0.38.0/go.mod h1:bSEAKrOT1W+VSu9TSCMtoGEOUcKxOKgl3LE5QEF/xVg= +golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= +golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU= +golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A= golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= @@ -171,3 +173,5 @@ gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EV gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= +mvdan.cc/sh/v3 v3.13.1 h1:DP3TfgZhDkT7lerUdnp6PTGKyxxzz6T+cOlY/xEvfWk= +mvdan.cc/sh/v3 v3.13.1/go.mod h1:lXJ8SexMvEVcHCoDvAGLZgFJ9Wsm2sulmoNEXGhYZD0= diff --git a/main.go b/main.go index b0d7a77..b31ca15 100644 --- a/main.go +++ b/main.go @@ -13,6 +13,8 @@ import ( "path/filepath" "strings" + "mvdan.cc/sh/v3/shell" + "github.com/caarlos0/env/v11" "github.com/charmbracelet/glamour" "github.com/charmbracelet/glamour/styles" @@ -319,8 +321,11 @@ func executeCLI(cmd *cobra.Command, src *source, w io.Writer) error { pagerCmd = "less -r" } - pa := strings.Split(pagerCmd, " ") - c := exec.Command(pa[0], pa[1:]...) //nolint:gosec + fields, err := shell.Fields(pagerCmd, os.Getenv) + if err != nil || len(fields) == 0 { + return fmt.Errorf("unable to parse PAGER command: %s", pagerCmd) + } + c := exec.Command(fields[0], fields[1:]...) //nolint:gosec c.Stdin = strings.NewReader(out) c.Stdout = os.Stdout if err := c.Run(); err != nil { From 1130f2d89f0ecb9b34412719a1bbd4218cc37d6f Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Thu, 9 Apr 2026 16:18:13 -0300 Subject: [PATCH 12/15] ci: fix govulncheck (#927) --- go.mod | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/go.mod b/go.mod index ad021fa..26b474d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,6 @@ module github.com/charmbracelet/glow/v2 -go 1.25.0 +go 1.25.9 require ( github.com/atotto/clipboard v0.1.4 From f57087499b407d420cdad1d76d0e1ed33c77a3d8 Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Thu, 9 Apr 2026 17:25:27 -0300 Subject: [PATCH 13/15] v2.1.2 From 53788271b387c23b20b0db69fea2fd552593623b Mon Sep 17 00:00:00 2001 From: Andrey Nering Date: Wed, 22 Apr 2026 11:14:50 -0300 Subject: [PATCH 14/15] chore: remove CODEOWNERS --- .github/CODEOWNERS | 1 - 1 file changed, 1 deletion(-) delete mode 100644 .github/CODEOWNERS diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS deleted file mode 100644 index 3c190d7..0000000 --- a/.github/CODEOWNERS +++ /dev/null @@ -1 +0,0 @@ -* @charmbracelet/everyone From e5cb757278216f84400466a47c987f56ea2de5c4 Mon Sep 17 00:00:00 2001 From: Drew Smirnoff Date: Tue, 4 Aug 2026 18:41:27 +0400 Subject: [PATCH 15/15] chore: govulncheck bumps (#1004) Signed-off-by: drew --- go.mod | 14 ++++++++------ go.sum | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 16 deletions(-) diff --git a/go.mod b/go.mod index 26b474d..6e05b0d 100644 --- a/go.mod +++ b/go.mod @@ -1,6 +1,8 @@ module github.com/charmbracelet/glow/v2 -go 1.25.9 +go 1.25.12 + +toolchain go1.26.5 require ( github.com/atotto/clipboard v0.1.4 @@ -24,9 +26,9 @@ require ( github.com/sahilm/fuzzy v0.1.1 github.com/spf13/cobra v1.10.2 github.com/spf13/viper v1.21.0 - golang.org/x/sys v0.42.0 - golang.org/x/term v0.41.0 - golang.org/x/text v0.32.0 + golang.org/x/sys v0.43.0 + golang.org/x/term v0.42.0 + golang.org/x/text v0.39.0 mvdan.cc/sh/v3 v3.13.1 ) @@ -64,10 +66,10 @@ require ( github.com/spf13/pflag v1.0.10 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect - github.com/yuin/goldmark v1.7.8 // indirect + github.com/yuin/goldmark v1.7.17 // indirect github.com/yuin/goldmark-emoji v1.0.5 // indirect go.yaml.in/yaml/v3 v3.0.4 // indirect golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 // indirect - golang.org/x/net v0.40.0 // indirect + golang.org/x/net v0.53.0 // indirect gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c // indirect ) diff --git a/go.sum b/go.sum index 9880660..0ccd7cd 100644 --- a/go.sum +++ b/go.sum @@ -149,24 +149,24 @@ github.com/subosito/gotenv v1.6.0/go.mod h1:Dk4QP5c2W3ibzajGcXpNraDfq2IrhjMIvMSW github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no= github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM= github.com/yuin/goldmark v1.7.1/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= -github.com/yuin/goldmark v1.7.8 h1:iERMLn0/QJeHFhxSt3p6PeN9mGnvIKSpG9YYorDMnic= -github.com/yuin/goldmark v1.7.8/go.mod h1:uzxRWxtg69N339t3louHJ7+O03ezfj6PlliRlaOzY1E= +github.com/yuin/goldmark v1.7.17 h1:p36OVWwRb246iHxA/U4p8OPEpOTESm4n+g+8t0EE5uA= +github.com/yuin/goldmark v1.7.17/go.mod h1:ip/1k0VRfGynBgxOz0yCqHrbZXhcjxyuS66Brc7iBKg= github.com/yuin/goldmark-emoji v1.0.5 h1:EMVWyCGPlXJfUXBXpuMu+ii3TIaxbVBnEX9uaDC4cIk= github.com/yuin/goldmark-emoji v1.0.5/go.mod h1:tTkZEbwu5wkPmgTcitqddVxY9osFZiavD+r4AzQrh1U= go.yaml.in/yaml/v3 v3.0.4 h1:tfq32ie2Jv2UxXFdLJdh3jXuOzWiL1fo0bu/FbuKpbc= go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg= golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8 h1:LoYXNGAShUG3m/ehNk4iFctuhGX/+R1ZpfJ4/ia80JM= golang.org/x/exp v0.0.0-20240604190554-fc45aab8b7f8/go.mod h1:jj3sYF3dwk5D+ghuXyeI3r5MFf+NT2An6/9dOA95KSI= -golang.org/x/net v0.40.0 h1:79Xs7wF06Gbdcg4kdCCIQArK11Z1hr5POQ6+fIYHNuY= -golang.org/x/net v0.40.0/go.mod h1:y0hY0exeL2Pku80/zKK7tpntoX23cqL3Oa6njdgRtds= +golang.org/x/net v0.53.0 h1:d+qAbo5L0orcWAr0a9JweQpjXF19LMXJE8Ey7hwOdUA= +golang.org/x/net v0.53.0/go.mod h1:JvMuJH7rrdiCfbeHoo3fCQU24Lf5JJwT9W3sJFulfgs= golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= -golang.org/x/sys v0.42.0 h1:omrd2nAlyT5ESRdCLYdm3+fMfNFE/+Rf4bDIQImRJeo= -golang.org/x/sys v0.42.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= -golang.org/x/term v0.41.0 h1:QCgPso/Q3RTJx2Th4bDLqML4W6iJiaXFq2/ftQF13YU= -golang.org/x/term v0.41.0/go.mod h1:3pfBgksrReYfZ5lvYM0kSO0LIkAl4Yl2bXOkKP7Ec2A= -golang.org/x/text v0.32.0 h1:ZD01bjUt1FQ9WJ0ClOL5vxgxOI/sVCNgX1YtKwcY0mU= -golang.org/x/text v0.32.0/go.mod h1:o/rUWzghvpD5TXrTIBuJU77MTaN0ljMWE47kxGJQ7jY= +golang.org/x/sys v0.43.0 h1:Rlag2XtaFTxp19wS8MXlJwTvoh8ArU6ezoyFsMyCTNI= +golang.org/x/sys v0.43.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw= +golang.org/x/term v0.42.0 h1:UiKe+zDFmJobeJ5ggPwOshJIVt6/Ft0rcfrXZDLWAWY= +golang.org/x/term v0.42.0/go.mod h1:Dq/D+snpsbazcBG5+F9Q1n2rXV8Ma+71xEjTRufARgY= +golang.org/x/text v0.39.0 h1:UbZz4pLOvn600D6Oh6GGEI6VAmndrEBLv8/6BEXzyus= +golang.org/x/text v0.39.0/go.mod h1:3UwRclnC2g0TU9x8PZiyfOajCd1zaUNHF9cvqcQZ+ZM= gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q=