https://github.com/dungtc/go-cli-playground
Create a simple cli (command line interface) tool from scratch in Golang
https://github.com/dungtc/go-cli-playground
boltdb cli cli-tool golang scratch scratch-implementation tool
Last synced: 3 months ago
JSON representation
Create a simple cli (command line interface) tool from scratch in Golang
- Host: GitHub
- URL: https://github.com/dungtc/go-cli-playground
- Owner: dungtc
- Created: 2021-01-15T10:37:44.000Z (over 5 years ago)
- Default Branch: main
- Last Pushed: 2021-01-18T02:51:54.000Z (about 5 years ago)
- Last Synced: 2023-03-21T22:09:08.058Z (about 3 years ago)
- Topics: boltdb, cli, cli-tool, golang, scratch, scratch-implementation, tool
- Language: Go
- Homepage: https://github.com/dungtc
- Size: 2.21 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Create a simple cli (command line interface) tool from scratch in Golang
A cli interacts with computer program like go, docker, k8s, npm, vice versa.
Example:
```console
$ go get -u URL
$ docker run -t image
$ kubectl get pods
$ npm install --save package
```
A common structure
```
App Subcommands --Flags Args
```
**App** has many subcommands
**Subcommands** has own flags and arguments
# Build
```console
$ go install github.com/dungtc/go-cli-playground
```
It will install your binary into $PATH
# Usage
### Help
```console
-help
Usage:
go-cli-playground [command]
Available Commands:
add Add a new task
count Count total tasks
list List of tasks
```
### Add task command
```console
$ go-cli-playground add Make a cookie
```
### List task command
```console
$ go-cli-playground list
1. Do some thing
2. Make a cookie
```
### Count task command
```console
$ go-cli-playground count
Count: 2
```