Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/achanandhi-m/go-cobra-cli-project

Creating my own cli command
https://github.com/achanandhi-m/go-cobra-cli-project

Last synced: about 1 month ago
JSON representation

Creating my own cli command

Awesome Lists containing this project

README

        

# Go Cobra CLI Project

Welcome to the Go Cobra CLI project! This project is a simple command-line tool built using Go and Cobra CLI. It fetches a random quote from an external API and displays it in the console.

## Getting Started

To get started with this project, follow these steps:

### Prerequisites

- **Go**: Ensure you have Go installed on your system. You can download and install it from [the official Go website](https://golang.org/dl/).
- **Cobra CLI**: Install Cobra CLI, a popular library for creating powerful modern CLI applications in Go. You can install it using the following command:
```sh
go get -u github.com/spf13/cobra/cobra
```

### Installation

Clone this repository to your local machine using the following command:
```sh
git clone https://github.com/Achanandhi-M/go-cobra-cli-project.git
```

### Usage

Navigate to the project directory and run the following command to execute the CLI:
```sh
go run main.go random
```

### Environment Setup

Before running the CLI, make sure to set up the required environment variable for the API endpoint. Use the provided `env.sh` file to set the API endpoint. You can do this by running the following command:
```sh
source env.sh
```

### Issues

If you encounter any issues while using this project, feel free to [open an issue](https://github.com/Achanandhi-M/go-cobra-cli-project/issues) on GitHub.

---