From 6da2ae9896704fb6bea9175f763b57b77d1f60fc Mon Sep 17 00:00:00 2001 From: Christian Date: Tue, 17 Sep 2024 21:34:51 -0700 Subject: [PATCH 1/6] fixing LegacyKeyValueFormat error --- Dockerfile | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Dockerfile b/Dockerfile index fc1bdb1..40d49bf 100644 --- a/Dockerfile +++ b/Dockerfile @@ -2,8 +2,8 @@ FROM golang:1.21-alpine3.19 WORKDIR /app -ENV TERM xterm-256color -ENV COLOR_OUTPUT true +ENV TERM=xterm-256color +ENV COLOR_OUTPUT=true COPY . /app From b172a24126f66c4b429dff9ae73b48e90aabc5ab Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 20 Sep 2024 12:11:12 -0700 Subject: [PATCH 2/6] updating tests --- cli_test.go | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/cli_test.go b/cli_test.go index 8015948..7bdde93 100644 --- a/cli_test.go +++ b/cli_test.go @@ -74,6 +74,25 @@ func TestCLI(t *testing.T) { "╰──────────────────────────────────────────────────────────────╯\n", expectedExit: 0, }, + { + args: []string{"--help"}, + expectedOutput: "╭─────────────────────────────────────────────────────────────╮\n" + + "│Welcome! This tool displays data related to Pokémon! │\n" + + "│ │\n" + + "│ USAGE: │\n" + + "│ poke-cli [flag] │\n" + + "│ poke-cli [command] [flag] │\n" + + "│ poke-cli [command] [subcommand] [flag] │\n" + + "│ │\n" + + "│ FLAGS: │\n" + + "│ -h, --help Shows the help menu │\n" + + "│ -l, --latest Prints the latest version of the program │\n" + + "│ │\n" + + "│ AVAILABLE COMMANDS: │\n" + + "│ pokemon Get details of a specific Pokémon │\n" + + "╰─────────────────────────────────────────────────────────────╯\n", + expectedExit: 0, + }, } for _, test := range tests { From 9eb4a432c00f275eb045fab928ba8ddadb02543e Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 20 Sep 2024 22:58:15 -0700 Subject: [PATCH 3/6] updating version number --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 38612a7..e4c42dc 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: branches: - main env: - VERSION_NUMBER: 'v0.4.2' + VERSION_NUMBER: 'v0.4.3' REGISTRY_NAME: digitalghostdev/poke-cli jobs: From ec8d8bb7bd44dc87aaa3f65ebe6a063f07259262 Mon Sep 17 00:00:00 2001 From: Christian Date: Fri, 20 Sep 2024 22:58:39 -0700 Subject: [PATCH 4/6] updating version number --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 762fc2b..06a7e81 100644 --- a/README.md +++ b/README.md @@ -40,13 +40,13 @@ git clone https://github.com/digitalghost-dev/poke-cli.git ### Docker Use a Docker Image instead: ```bash -docker run --rm -it digitalghostdev/poke-cli:v0.4.2 [command] [subcommand] [flag] +docker run --rm -it digitalghostdev/poke-cli:v0.4.3 [command] [subcommand] [flag] ``` ## Usage By running `poke-cli [-h | --help]`, it'll display information on how to use the tool. ``` -Welcome! This tool displays data about a selected Pokémon in the terminal! +Welcome! This tool displays data related to Pokémon! USAGE: poke-cli [flag] From 003c87923e69d5b4c884d12d7d8b7f8d2d5e530d Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 21 Sep 2024 12:04:08 -0700 Subject: [PATCH 5/6] adding border to help menu --- cli.go | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/cli.go b/cli.go index 5a401ab..b0af3e7 100644 --- a/cli.go +++ b/cli.go @@ -9,31 +9,31 @@ import ( "os" ) -func main() { - var styleBold = lipgloss.NewStyle().Bold(true) +var ( + styleBold = lipgloss.NewStyle().Bold(true) + helpBorder = lipgloss.NewStyle(). + BorderStyle(lipgloss.RoundedBorder()). + BorderForeground(lipgloss.Color("#FFCC00")) +) +func main() { latestFlag := flag.Bool("latest", false, "Prints the program's latest Docker Image and Release versions.") shortLatestFlag := flag.Bool("l", false, "Prints the program's latest Docker Image and Release versions.") flag.Usage = func() { - fmt.Println("Welcome! This tool displays data about a selected Pokémon in the terminal!") - - // Usage section - fmt.Println(styleBold.Render("\nUSAGE:")) - fmt.Println("\t", "poke-cli [flag]") - fmt.Println("\t", "poke-cli [command] [flag]") - fmt.Println("\t", "poke-cli [command] [subcommand] [flag]") - - // Flags section - fmt.Println(styleBold.Render("\nFLAGS:")) - fmt.Println("\t", "-h, --help", "\t\t", "Shows the help menu") - fmt.Println("\t", "-l, --latest", "\t\t", "Prints the latest version of the program") - fmt.Print("\n") - - // Commands section - fmt.Println(styleBold.Render("\nCOMMANDS")) - fmt.Println("\t", "pokemon", "\t\t", "Get details of a specific Pokémon") - fmt.Print("\n") + helpMessage := helpBorder.Render( + "Welcome! This tool displays data related to Pokémon!", + "\n\n", styleBold.Render("USAGE:"), + fmt.Sprintf("\n\t%-15s %s", "poke-cli [flag]", ""), + fmt.Sprintf("\n\t%-15s %s", "poke-cli [command] [flag]", ""), + fmt.Sprintf("\n\t%-15s %s", "poke-cli [command] [subcommand] [flag]", ""), + "\n\n", styleBold.Render("FLAGS:"), + fmt.Sprintf("\n\t%-15s %s", "-h, --help", "Shows the help menu"), + fmt.Sprintf("\n\t%-15s %s", "-l, --latest", "Prints the latest version of the program"), + "\n\n", styleBold.Render("AVAILABLE COMMANDS:"), + fmt.Sprintf("\n\t%-15s %s", "pokemon", "Get details of a specific Pokémon"), + ) + fmt.Println(helpMessage) } flag.Parse() From c70ac0cf575fe2bb666933734f285528e49cf1ab Mon Sep 17 00:00:00 2001 From: Christian Date: Sat, 21 Sep 2024 12:07:08 -0700 Subject: [PATCH 6/6] fixing tab spacing --- cmd/pokemon.go | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/cmd/pokemon.go b/cmd/pokemon.go index 3741af9..60d588c 100644 --- a/cmd/pokemon.go +++ b/cmd/pokemon.go @@ -58,17 +58,21 @@ func ValidateArgs(args []string) error { func PokemonCommand() { flag.Usage = func() { - fmt.Println( - helpBorder.Render(styleBold.Render("USAGE:"), "\n\t", "poke-cli", styleBold.Render("pokemon"), "", "[flag]", - "\n\t", "Get details about a specific Pokémon", - "\n\t", "----------", - "\n\t", styleItalic.Render("Examples:"), "\t", "poke-cli pokemon bulbasaur", - "\n\t\t\t", "poke-cli pokemon flutter-mane --types", - "\n\t\t\t", "poke-cli pokemon excadrill -t -a", - "\n", - styleBold.Render("\nFLAGS:"), "\n\t", "-a, --abilities", "\t", "Prints out the Pokémon's abilities.", - "\n\t", "-t, --types", "\t\t", "Prints out the Pokémon's typing."), + helpMessage := helpBorder.Render( + styleBold.Render("USAGE:"), + fmt.Sprintf("\n\t%s %s %s %s", "poke-cli", styleBold.Render("pokemon"), "", "[flag]"), + fmt.Sprintf("\n\t%-30s", "Get details about a specific Pokémon"), + fmt.Sprintf("\n\t%-30s", "----------"), + fmt.Sprintf("\n\t%-30s", styleItalic.Render("Examples:\n")), + fmt.Sprintf("\n\t%-30s", "poke-cli pokemon bulbasaur"), + fmt.Sprintf("\n\t%-30s", "poke-cli pokemon flutter-mane --types"), + fmt.Sprintf("\n\t%-30s", "poke-cli pokemon excadrill -t -a"), + "\n\n", + styleBold.Render("FLAGS:"), + fmt.Sprintf("\n\t%-30s %s", "-a, --abilities", "Prints out the Pokémon's abilities."), + fmt.Sprintf("\n\t%-30s %s", "-t, --types", "Prints out the Pokémon's typing."), ) + fmt.Println(helpMessage) } flag.Parse()