Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
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
- Host: GitHub
- URL: https://github.com/achanandhi-m/go-cobra-cli-project
- Owner: Achanandhi-M
- License: other
- Created: 2024-06-07T16:31:15.000Z (8 months ago)
- Default Branch: main
- Last Pushed: 2024-06-07T16:40:51.000Z (8 months ago)
- Last Synced: 2024-11-05T22:05:56.363Z (3 months ago)
- Language: Go
- Size: 4.88 KB
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
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.
---