diff --git a/CHANGELOG.md b/CHANGELOG.md index 6fc18ce..6c7f41b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +### Changed +- Replace [manifoldco/promptui](https://github.com/charmbracelet/huh) with [charmbracelet/huh](https://github.com/charmbracelet/huh) due to lack of maintainer +- code cleanup pass, simplified structs, improved messaging, aligned variable naming ## [0.5.4] - 2024-03-29 ### Fixed diff --git a/go.mod b/go.mod index 6e275b5..334e37d 100644 --- a/go.mod +++ b/go.mod @@ -18,8 +18,8 @@ require ( github.com/catppuccin/go v0.2.0 // indirect github.com/charmbracelet/bubbles v0.18.0 // indirect github.com/charmbracelet/bubbletea v0.25.0 // indirect - github.com/charmbracelet/lipgloss v0.9.1 // indirect - github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect + github.com/charmbracelet/lipgloss v0.10.0 // indirect + github.com/containerd/console v1.0.4 // indirect github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect github.com/gdamore/encoding v1.0.1 // indirect github.com/lucasb-eyer/go-colorful v1.2.0 // indirect diff --git a/go.sum b/go.sum index bc1c3d7..e0bfcd1 100644 --- a/go.sum +++ b/go.sum @@ -14,8 +14,12 @@ github.com/charmbracelet/huh/spinner v0.0.0-20240328185852-590ecabc34b9 h1:gC8Qv github.com/charmbracelet/huh/spinner v0.0.0-20240328185852-590ecabc34b9/go.mod h1:nrBG0YEHaxdbqHXW1xvG1hPqkuac9Eg7RTMvogiXuz0= github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg= github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I= +github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s= +github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY= github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= +github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro= +github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk= github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4= github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o= github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= diff --git a/gojira/cli.go b/gojira/cli.go index 6df6790..ef40590 100644 --- a/gojira/cli.go +++ b/gojira/cli.go @@ -96,7 +96,7 @@ var IssuesCommand = &cli.Command{ if err != nil { return err } - timeSpent, err := InputTimeSpentForm() + timeSpent, err := InputTimeSpentForm(issue) if err != nil { return err } @@ -131,10 +131,8 @@ var LogWorkCommand = &cli.Command{ if err != nil { return err } - fmt.Printf("%s %s\n", issue.Key, issue.Fields.Summary) - fmt.Printf("Status: %s\n", issue.Fields.Status.Name) if timeSpent == "" { - timeSpent, err = InputTimeSpentForm() + timeSpent, err = InputTimeSpentForm(issue) if err != nil { return err } @@ -183,9 +181,7 @@ var GitOrIssueListAction = func(c *cli.Context) error { if err != nil { return err } - fmt.Printf("Status: %s\nSummary: %s\n", issue.Fields.Status.Name, issue.Fields.Summary) - // log time or view issue - timeSpent, err := InputTimeSpentForm() + timeSpent, err := InputTimeSpentForm(issue) if err != nil { return nil } diff --git a/gojira/prompt.go b/gojira/prompt.go index 8d81726..bd61a15 100644 --- a/gojira/prompt.go +++ b/gojira/prompt.go @@ -42,6 +42,7 @@ func SelectIssueForm(issues []Issue) (Issue, error) { huh.NewGroup( huh.NewSelect[Issue](). Title("Choose issue"). + Description("Recently updated issues assigned to you:"). Options(formOptions...). Value(&chosenIssue), ), @@ -55,13 +56,14 @@ func SelectIssueForm(issues []Issue) (Issue, error) { return chosenIssue, nil } -func InputTimeSpentForm() (string, error) { +func InputTimeSpentForm(issue Issue) (string, error) { timeSpent := "" form := huh.NewForm( huh.NewGroup( huh.NewInput(). Title("Log time"). + Description(fmt.Sprintf("%s %s", issue.Key, issue.Fields.Summary)). Placeholder("1h / 1h30m / 30m"). Value(&timeSpent). Validate(func(input string) error {