Skip to content
Myr

main.go

This file

Path

main.go

90 lines · 2.2 KiB · Go

Last changed by

chore: prepare v2 (#1116)Drew Smirnoffbefore adoption02d6f06

History of this file

Take it

The walk stopped after 200 commits: lines older than 6837ed2 point at it.

fix: lint issues (#909)Carlos Alexandro Beckerbefore adoption817c4bd

line 1why, one step back
1// Package main is Gum: a tool for glamorous shell scripts.

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 2–9why, one step back
2package main
34import (5 "errors"6 "fmt"7 "os"8 "runtime/debug"9

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

line 10why, one step back
10 tea "charm.land/bubbletea/v2"

chore: prepare v2 (#1116)Drew Smirnoffbefore adoption02d6f06

line 11why, one step back
11 "charm.land/gum/v2/internal/exit"

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

line 12why, one step back
12 "charm.land/lipgloss/v2"

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 13–17why, one step back
13 "github.com/alecthomas/kong"
14)1516const shaLen = 717

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

lines 18–19why, one step back
18const defaultBool = "false"
19

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 20–56why, one step back
20var (
21 // Version contains the application version number. It's set via ldflags22 // when building.23 Version = ""2425 // CommitSHA contains the SHA of the commit that this application was built26 // against. It's set via ldflags when building.27 CommitSHA = ""28)2930var bubbleGumPink = lipgloss.NewStyle().Foreground(lipgloss.Color("212"))3132func main() {33 if Version == "" {34 if info, ok := debug.ReadBuildInfo(); ok && info.Main.Sum != "" {35 Version = info.Main.Version36 } else {37 Version = "unknown (built from source)"38 }39 }40 version := fmt.Sprintf("gum version %s", Version)41 if len(CommitSHA) >= shaLen {42 version += " (" + CommitSHA[:shaLen] + ")"43 }4445 gum := &Gum{}46 ctx := kong.Parse(47 gum,48 kong.Description(fmt.Sprintf("A tool for %s shell scripts.", bubbleGumPink.Render("glamorous"))),49 kong.UsageOnError(),50 kong.ConfigureHelp(kong.HelpOptions{51 Compact: true,52 Summary: false,53 NoExpandSubcommands: true,54 }),55 kong.Vars{56 "version": version,

feat(version): adds command to check current gum version (#775)Carlos Alexandro Beckerbefore adoption64d69eb

line 57why, one step back
57 "versionNumber": Version,

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 58–67why, one step back
58 "defaultHeight": "0",
59 "defaultWidth": "0",60 "defaultAlign": "left",61 "defaultBorder": "none",62 "defaultBorderForeground": "",63 "defaultBorderBackground": "",64 "defaultBackground": "",65 "defaultForeground": "",66 "defaultMargin": "0 0",67 "defaultPadding": "0 0",

chore: update to bubbletea v2 (#1112)Drew Smirnoffbefore adoptionf6dd28e

lines 68–72why, one step back
68 "defaultUnderline": defaultBool,
69 "defaultBold": defaultBool,70 "defaultFaint": defaultBool,71 "defaultItalic": defaultBool,72 "defaultStrikethrough": defaultBool,

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 73–75why, one step back
73 },
74 )75 if err := ctx.Run(); err != nil {

refactor: removing huh as a dep (#742)Carlos Alexandro Beckerbefore adoptione30fc5e

lines 76–79why, one step back
76 var ex exit.ErrExit
77 if errors.As(err, &ex) {78 os.Exit(int(ex))79 }

fix: logic to handle interrupt before timeout in error checking (#918)arithmeticmeanbefore adoption8081f74

lines 80–82why, one step back
80 if errors.Is(err, tea.ErrInterrupted) {
81 os.Exit(exit.StatusAborted)82 }

feat: handle interrupts and timeouts (#747)Carlos Alexandro Beckerbefore adoption4f46952

lines 83–84why, one step back
83 if errors.Is(err, tea.ErrProgramKilled) {
84 fmt.Fprintln(os.Stderr, "timed out")

fix(confirm,choose,file,input): timeout handling (#718)Carlos Alexandro Beckerbefore adoptionc868aa1

line 85why, one step back
85 os.Exit(exit.StatusTimeout)

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

line 86why, one step back
86 }

fix(confirm,choose,file,input): timeout handling (#718)Carlos Alexandro Beckerbefore adoptionc868aa1

line 87why, one step back
87 fmt.Fprintln(os.Stderr, err)

feat(deps): bump github.com/charmbracelet/bubbletea from 0.27.0 to 1.0.0 (#661)dependabot[bot]before adoption6837ed2

lines 88–90why, one step back
88 os.Exit(1)
89 }90}