@@ -3,24 +3,13 @@ package main
33import (
44 "flag"
55 "fmt"
6- "github.com/charmbracelet/lipgloss"
76 "github.com/digitalghost-dev/poke-cli/cmd"
87 "github.com/digitalghost-dev/poke-cli/flags"
8+ "github.com/digitalghost-dev/poke-cli/styling"
99 "os"
1010 "runtime/debug"
1111)
1212
13- var (
14- styleBold = lipgloss .NewStyle ().Bold (true )
15- helpBorder = lipgloss .NewStyle ().
16- BorderStyle (lipgloss .RoundedBorder ()).
17- BorderForeground (lipgloss .Color ("#FFCC00" ))
18- errorColor = lipgloss .NewStyle ().Foreground (lipgloss .Color ("#F2055C" ))
19- errorBorder = lipgloss .NewStyle ().
20- BorderStyle (lipgloss .RoundedBorder ()).
21- BorderForeground (lipgloss .Color ("#F2055C" ))
22- )
23-
2413var version = "(devel)"
2514
2615func currentVersion () {
@@ -56,21 +45,21 @@ func runCLI(args []string) int {
5645 shortCurrentVersionFlag := mainFlagSet .Bool ("v" , false , "Prints the current version" )
5746
5847 mainFlagSet .Usage = func () {
59- helpMessage := helpBorder .Render (
48+ helpMessage := styling . HelpBorder .Render (
6049 "Welcome! This tool displays data related to Pokémon!" ,
61- "\n \n " , styleBold .Render ("USAGE:" ),
50+ "\n \n " , styling . StyleBold .Render ("USAGE:" ),
6251 fmt .Sprintf ("\n \t %-15s %s" , "poke-cli [flag]" , "" ),
6352 fmt .Sprintf ("\n \t %-15s %s" , "poke-cli <command> [flag]" , "" ),
6453 fmt .Sprintf ("\n \t %-15s %s" , "poke-cli <command> <subcommand> [flag]" , "" ),
65- "\n \n " , styleBold .Render ("FLAGS:" ),
54+ "\n \n " , styling . StyleBold .Render ("FLAGS:" ),
6655 fmt .Sprintf ("\n \t %-15s %s" , "-h, --help" , "Shows the help menu" ),
6756 fmt .Sprintf ("\n \t %-15s %s" , "-l, --latest" , "Prints the latest version available" ),
6857 fmt .Sprintf ("\n \t %-15s %s" , "-v, --version" , "Prints the current version" ),
69- "\n \n " , styleBold .Render ("COMMANDS:" ),
58+ "\n \n " , styling . StyleBold .Render ("COMMANDS:" ),
7059 fmt .Sprintf ("\n \t %-15s %s" , "ability" , "Get details about an ability" ),
71- fmt .Sprintf ("\n \t %-15s %s" , "natures" , "Get details about Pokémon natures" ),
72- fmt .Sprintf ("\n \t %-15s %s" , "pokemon" , "Get details about a specific Pokémon" ),
73- fmt .Sprintf ("\n \t %-15s %s" , "types" , "Get details about a specific typing" ),
60+ fmt .Sprintf ("\n \t %-15s %s" , "natures" , "Get details about all natures" ),
61+ fmt .Sprintf ("\n \t %-15s %s" , "pokemon" , "Get details about a Pokémon" ),
62+ fmt .Sprintf ("\n \t %-15s %s" , "types" , "Get details about a typing" ),
7463 )
7564 fmt .Println (helpMessage )
7665 }
@@ -112,15 +101,15 @@ func runCLI(args []string) int {
112101 return 0
113102 } else {
114103 command := os .Args [1 ]
115- errMessage := errorBorder .Render (
116- errorColor .Render ("Error!" ),
104+ errMessage := styling . ErrorBorder .Render (
105+ styling . ErrorColor .Render ("Error!" ),
117106 fmt .Sprintf ("\n \t %-15s" , fmt .Sprintf ("'%s' is not a valid command.\n " , command )),
118- styleBold .Render ("\n Commands:" ),
107+ styling . StyleBold .Render ("\n Commands:" ),
119108 fmt .Sprintf ("\n \t %-15s %s" , "ability" , "Get details about an ability" ),
120- fmt .Sprintf ("\n \t %-15s %s" , "natures" , "Get details about Pokémon natures" ),
121- fmt .Sprintf ("\n \t %-15s %s" , "pokemon" , "Get details about a specific Pokémon" ),
122- fmt .Sprintf ("\n \t %-15s %s" , "types" , "Get details about a specific typing" ),
123- fmt .Sprintf ("\n \n Also run %s for more info!" , styleBold .Render ("poke-cli -h" )),
109+ fmt .Sprintf ("\n \t %-15s %s" , "natures" , "Get details about all natures" ),
110+ fmt .Sprintf ("\n \t %-15s %s" , "pokemon" , "Get details about a Pokémon" ),
111+ fmt .Sprintf ("\n \t %-15s %s" , "types" , "Get details about a typing" ),
112+ fmt .Sprintf ("\n \n Also run %s for more info!" , styling . StyleBold .Render ("poke-cli -h" )),
124113 )
125114 fmt .Printf ("%s\n " , errMessage )
126115 return 1
0 commit comments