Skip to content

Commit 2824ea6

Browse files
committed
further improvements while using huh
1 parent 0847733 commit 2824ea6

File tree

5 files changed

+14
-10
lines changed

5 files changed

+14
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,9 @@ All notable changes to this project will be documented in this file.
55
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).
66

77
## [Unreleased]
8+
### Changed
9+
- Replace [manifoldco/promptui](https://github.com/charmbracelet/huh) with [charmbracelet/huh](https://github.com/charmbracelet/huh) due to lack of maintainer
10+
- code cleanup pass, simplified structs, improved messaging, aligned variable naming
811

912
## [0.5.4] - 2024-03-29
1013
### Fixed

go.mod

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ require (
1818
github.com/catppuccin/go v0.2.0 // indirect
1919
github.com/charmbracelet/bubbles v0.18.0 // indirect
2020
github.com/charmbracelet/bubbletea v0.25.0 // indirect
21-
github.com/charmbracelet/lipgloss v0.9.1 // indirect
22-
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 // indirect
21+
github.com/charmbracelet/lipgloss v0.10.0 // indirect
22+
github.com/containerd/console v1.0.4 // indirect
2323
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
2424
github.com/gdamore/encoding v1.0.1 // indirect
2525
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect

go.sum

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,12 @@ github.com/charmbracelet/huh/spinner v0.0.0-20240328185852-590ecabc34b9 h1:gC8Qv
1414
github.com/charmbracelet/huh/spinner v0.0.0-20240328185852-590ecabc34b9/go.mod h1:nrBG0YEHaxdbqHXW1xvG1hPqkuac9Eg7RTMvogiXuz0=
1515
github.com/charmbracelet/lipgloss v0.9.1 h1:PNyd3jvaJbg4jRHKWXnCj1akQm4rh8dbEzN1p/u1KWg=
1616
github.com/charmbracelet/lipgloss v0.9.1/go.mod h1:1mPmG4cxScwUQALAAnacHaigiiHB9Pmr+v1VEawJl6I=
17+
github.com/charmbracelet/lipgloss v0.10.0 h1:KWeXFSexGcfahHX+54URiZGkBFazf70JNMtwg/AFW3s=
18+
github.com/charmbracelet/lipgloss v0.10.0/go.mod h1:Wig9DSfvANsxqkRsqj6x87irdy123SR4dOXlKa91ciE=
1719
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81 h1:q2hJAaP1k2wIvVRd/hEHD7lacgqrCPS+k8g1MndzfWY=
1820
github.com/containerd/console v1.0.4-0.20230313162750-1ae8d489ac81/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
21+
github.com/containerd/console v1.0.4 h1:F2g4+oChYvBTsASRTz8NP6iIAi97J3TtSAsLbIFn4ro=
22+
github.com/containerd/console v1.0.4/go.mod h1:YynlIjWYF8myEu6sdkwKIvGQq+cOckRm6So2avqoYAk=
1923
github.com/cpuguy83/go-md2man/v2 v2.0.4 h1:wfIWP927BUkWJb2NmU/kNDYIBTh/ziUX91+lVfRxZq4=
2024
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
2125
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=

gojira/cli.go

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ var IssuesCommand = &cli.Command{
9696
if err != nil {
9797
return err
9898
}
99-
timeSpent, err := InputTimeSpentForm()
99+
timeSpent, err := InputTimeSpentForm(issue)
100100
if err != nil {
101101
return err
102102
}
@@ -131,10 +131,8 @@ var LogWorkCommand = &cli.Command{
131131
if err != nil {
132132
return err
133133
}
134-
fmt.Printf("%s %s\n", issue.Key, issue.Fields.Summary)
135-
fmt.Printf("Status: %s\n", issue.Fields.Status.Name)
136134
if timeSpent == "" {
137-
timeSpent, err = InputTimeSpentForm()
135+
timeSpent, err = InputTimeSpentForm(issue)
138136
if err != nil {
139137
return err
140138
}
@@ -183,9 +181,7 @@ var GitOrIssueListAction = func(c *cli.Context) error {
183181
if err != nil {
184182
return err
185183
}
186-
fmt.Printf("Status: %s\nSummary: %s\n", issue.Fields.Status.Name, issue.Fields.Summary)
187-
// log time or view issue
188-
timeSpent, err := InputTimeSpentForm()
184+
timeSpent, err := InputTimeSpentForm(issue)
189185
if err != nil {
190186
return nil
191187
}

gojira/prompt.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,13 +55,14 @@ func SelectIssueForm(issues []Issue) (Issue, error) {
5555
return chosenIssue, nil
5656
}
5757

58-
func InputTimeSpentForm() (string, error) {
58+
func InputTimeSpentForm(issue Issue) (string, error) {
5959
timeSpent := ""
6060

6161
form := huh.NewForm(
6262
huh.NewGroup(
6363
huh.NewInput().
6464
Title("Log time").
65+
Description(fmt.Sprintf("%s %s", issue.Key, issue.Fields.Summary)).
6566
Placeholder("1h / 1h30m / 30m").
6667
Value(&timeSpent).
6768
Validate(func(input string) error {

0 commit comments

Comments
 (0)