mirror of
https://github.com/onyx-and-iris/lottery-cli.git
synced 2026-08-17 00:34:25 +00:00
lint fixes
make "Set For Life" easier to read.
This commit is contained in:
@@ -9,8 +9,9 @@ import (
|
|||||||
|
|
||||||
"charm.land/huh/v2"
|
"charm.land/huh/v2"
|
||||||
"github.com/charmbracelet/fang"
|
"github.com/charmbracelet/fang"
|
||||||
"github.com/onyx-and-iris/lottery-cli"
|
|
||||||
"github.com/spf13/cobra"
|
"github.com/spf13/cobra"
|
||||||
|
|
||||||
|
"github.com/onyx-and-iris/lottery-cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
var version string
|
var version string
|
||||||
@@ -40,7 +41,7 @@ var cmd = &cobra.Command{
|
|||||||
Options(
|
Options(
|
||||||
huh.NewOption("Lotto", "lotto"),
|
huh.NewOption("Lotto", "lotto"),
|
||||||
huh.NewOption("EuroMillions", "euromillions"),
|
huh.NewOption("EuroMillions", "euromillions"),
|
||||||
huh.NewOption("SetForLife", "setforlife"),
|
huh.NewOption("Set For Life", "setforlife"),
|
||||||
huh.NewOption("Thunderball", "thunderball"),
|
huh.NewOption("Thunderball", "thunderball"),
|
||||||
huh.NewOption("Powerball", "powerball"),
|
huh.NewOption("Powerball", "powerball"),
|
||||||
).
|
).
|
||||||
@@ -69,7 +70,11 @@ var cmd = &cobra.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
func main() {
|
func main() {
|
||||||
if err := fang.Execute(context.Background(), cmd, fang.WithVersion(versionFromBuild())); err != nil {
|
if err := fang.Execute(
|
||||||
|
context.Background(),
|
||||||
|
cmd,
|
||||||
|
fang.WithVersion(versionFromBuild()),
|
||||||
|
); err != nil {
|
||||||
os.Exit(1)
|
os.Exit(1)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import (
|
|||||||
"strings"
|
"strings"
|
||||||
|
|
||||||
"charm.land/lipgloss/v2"
|
"charm.land/lipgloss/v2"
|
||||||
|
|
||||||
"github.com/onyx-and-iris/lottery-cli"
|
"github.com/onyx-and-iris/lottery-cli"
|
||||||
)
|
)
|
||||||
|
|
||||||
@@ -16,6 +17,7 @@ func formatNumberList(numbers []int) string {
|
|||||||
return strings.Join(parts, " ")
|
return strings.Join(parts, " ")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// nolint:misspell
|
||||||
func renderDraw(l lottery.Lottery) string {
|
func renderDraw(l lottery.Lottery) string {
|
||||||
titleStyle := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("12"))
|
titleStyle := lipgloss.NewStyle().Bold(true).Foreground(lipgloss.Color("12"))
|
||||||
labelStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("8"))
|
labelStyle := lipgloss.NewStyle().Foreground(lipgloss.Color("8"))
|
||||||
@@ -28,23 +30,62 @@ func renderDraw(l lottery.Lottery) string {
|
|||||||
switch game := l.(type) {
|
switch game := l.(type) {
|
||||||
case *lottery.Lotto:
|
case *lottery.Lotto:
|
||||||
title = "Lotto"
|
title = "Lotto"
|
||||||
lines = append(lines, labelStyle.Render("Numbers:")+" "+numbersStyle.Render(formatNumberList(game.Numbers[:])))
|
lines = append(
|
||||||
|
lines,
|
||||||
|
labelStyle.Render(
|
||||||
|
"Numbers:",
|
||||||
|
)+" "+numbersStyle.Render(
|
||||||
|
formatNumberList(game.Numbers[:]),
|
||||||
|
),
|
||||||
|
)
|
||||||
case *lottery.EuroMillions:
|
case *lottery.EuroMillions:
|
||||||
title = "EuroMillions"
|
title = "EuroMillions"
|
||||||
lines = append(lines, labelStyle.Render("Main:")+" "+numbersStyle.Render(formatNumberList(game.Numbers[:])))
|
lines = append(
|
||||||
lines = append(lines, labelStyle.Render("Lucky Stars:")+" "+specialStyle.Render(formatNumberList(game.LuckyStars[:])))
|
lines,
|
||||||
|
labelStyle.Render("Main:")+" "+numbersStyle.Render(formatNumberList(game.Numbers[:])),
|
||||||
|
)
|
||||||
|
lines = append(
|
||||||
|
lines,
|
||||||
|
labelStyle.Render(
|
||||||
|
"Lucky Stars:",
|
||||||
|
)+" "+specialStyle.Render(
|
||||||
|
formatNumberList(game.LuckyStars[:]),
|
||||||
|
),
|
||||||
|
)
|
||||||
case *lottery.SetForLife:
|
case *lottery.SetForLife:
|
||||||
title = "Set For Life"
|
title = "Set For Life"
|
||||||
lines = append(lines, labelStyle.Render("Main:")+" "+numbersStyle.Render(formatNumberList(game.Numbers[:])))
|
lines = append(
|
||||||
lines = append(lines, labelStyle.Render("Life Ball:")+" "+specialStyle.Render(strconv.Itoa(game.LifeBall)))
|
lines,
|
||||||
|
labelStyle.Render("Main:")+" "+numbersStyle.Render(formatNumberList(game.Numbers[:])),
|
||||||
|
)
|
||||||
|
lines = append(
|
||||||
|
lines,
|
||||||
|
labelStyle.Render("Life Ball:")+" "+specialStyle.Render(strconv.Itoa(game.LifeBall)),
|
||||||
|
)
|
||||||
case *lottery.Thunderball:
|
case *lottery.Thunderball:
|
||||||
title = "Thunderball"
|
title = "Thunderball"
|
||||||
lines = append(lines, labelStyle.Render("Main:")+" "+numbersStyle.Render(formatNumberList(game.Numbers[:])))
|
lines = append(
|
||||||
lines = append(lines, labelStyle.Render("Thunderball:")+" "+specialStyle.Render(strconv.Itoa(game.Thunderball)))
|
lines,
|
||||||
|
labelStyle.Render("Main:")+" "+numbersStyle.Render(formatNumberList(game.Numbers[:])),
|
||||||
|
)
|
||||||
|
lines = append(
|
||||||
|
lines,
|
||||||
|
labelStyle.Render(
|
||||||
|
"Thunderball:",
|
||||||
|
)+" "+specialStyle.Render(
|
||||||
|
strconv.Itoa(game.Thunderball),
|
||||||
|
),
|
||||||
|
)
|
||||||
case *lottery.Powerball:
|
case *lottery.Powerball:
|
||||||
title = "Powerball"
|
title = "Powerball"
|
||||||
lines = append(lines, labelStyle.Render("Main:")+" "+numbersStyle.Render(formatNumberList(game.Numbers[:])))
|
lines = append(
|
||||||
lines = append(lines, labelStyle.Render("Powerball:")+" "+specialStyle.Render(strconv.Itoa(game.Powerball)))
|
lines,
|
||||||
|
labelStyle.Render("Main:")+" "+numbersStyle.Render(formatNumberList(game.Numbers[:])),
|
||||||
|
)
|
||||||
|
lines = append(
|
||||||
|
lines,
|
||||||
|
labelStyle.Render("Powerball:")+" "+specialStyle.Render(strconv.Itoa(game.Powerball)),
|
||||||
|
)
|
||||||
default:
|
default:
|
||||||
title = "Lottery"
|
title = "Lottery"
|
||||||
lines = append(lines, "Unknown lottery type")
|
lines = append(lines, "Unknown lottery type")
|
||||||
|
|||||||
Reference in New Issue
Block a user