Giter VIP home page Giter VIP logo

poke-cli's Introduction

pokemon-logo

Pokémon CLI

version-label docker-image-size
tests-label go-version

Overview

A CLI tool for viewing data about Pokémon from your terminal!

Install

Go Build

  1. Make sure Go is installed on your machine. This project uses v1.21.
    • If on Windows, install Git as well.
  2. Create a new directory.
    • For example, name the directory poke-cli.
    • Run cd poke-cli to move into that directory after creation.
    • Run git init to initialize the repository/directory.
  3. Clone the repository in the previously initialized directory:
git clone https://github.com/digitalghost-dev/poke-cli.git
  1. Run go build .
  2. A binary will be created then the tool can be used! It can also be added to your path to run the binary from anywhere.
    • Example usage:
# Windows
.\poke-cli.exe charizard --types --abilities

# Unix
.\poke-cli vespiquen --types --abilities

Docker

Use a Docker Image instead:

docker run --rm -it digitalghostdev/poke-cli:v0.3.2 [command] [flag]

Usage

By running poke-cli --help, it'll display information on how to use the tool.

Welcome! This tool displays data about a selected Pokémon in the terminal!
      
USAGE:
         poke-cli [flag]
         poke-cli [pokemon name] [flag]
         ----------
         Example: poke-cli bulbasaur or poke-cli flutter-mane --types
             
GLOBAL FLAGS:
         -h, --help      Shows the help menu

POKEMON NAME FLAGS:
         Add a flag after declaring a Pokémon's name for more details!
        --types
        --abilities

poke-cli's People

Contributors

digitalghost-dev avatar

Watchers

Lucian avatar  avatar

poke-cli's Issues

Add an abilities flag

Add a new feature that prints the chosen Pokémon's ability or abilities.

For example:

poke-cli ambipom --abilities

output:
image

Move logic for --types flagset to TypesFlag()

Currently, the logic for printing out a Pokemon's typing is handled in the connections/connection.go file.

It makes more sense to move this logic under the TypesFlag() function in the flags/pokemonflagset.go file and to keep only API related logic in connections/connection.go.

Add better error handling for arguments

With the addition of the --abilities flag in v0.3.0, this allows users to declare multiple flags at once now. Updated error handling is needed to allow for multiple flags and to disallow non-flag arguments.

For example:

# ok
$ poke-cli gliscor --types --abilities

# error
$ poke-cli pikachu --types all

# error
$ poke-cli hippowown all --abilities

Move struct outside of functions

Currently, the type Pokemon struct set up for reading the JSON response is broken up into two structs and placed locally inside different functions. For scalability and less redundancy, placing this struct in a global manner will help with this.

Better display Pokémon's hidden ability

When using the Poké API, a Pokémon's ability is listed as ability_3. To better display the hidden ability, add logic that will check if the pokeAbility.Slot in the pokemonStruct is == 3.

Update help message

When running poke-cli --help, the message needs to be updated to include the --abilities flag added in v0.3.0

Create a pokemon subcommand

Create a pokemon subcommand that will read os.Args[1] as a typed Pokémon's name.

For example: poke-cli bulbasaur or poke-cli iron-treads.

Create a connections file

Create a connections.go and a connections_test.go file under a connections/ directory.

This file will hold all of the code responsible for calling the API.

v0.1.0 will have one base API call function and two endpoint call functions:
func baseApiCall()
func PokemonNameApiCall()
func PokemonTypeApiCall()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.