[Table of Contents]
This is an example or starter providing guidance in creating CLIs using Golang.
This repo provides a central location of guidance for best practices when creating CLIs using Golang
The goal of this repo is to create a location for folks to get information they need to create a CLI using Golang.
In the end this repo will provide guidance for the following:
- Basic and Advanced CLI examples
- Binary releases
What things you need to install the software and how to install them
If you want to download and run, the latest pre-built binaries available
For Linux and MacOS with Gatekeeper enabled
chmod +x <binary file name>
./<binary file name>
A list of available commands
go run main.go
Example cli tool based on golang!
Usage:
cli-gopher [command]
Available Commands:
config Simple config command
count A simple count command
date A simple date command
env A simple environment command
help Help about any command
password A simple password command
spinner A simple spinner command
version The version number of cli-gopher
Flags:
-h, --help help for cli-gopher
Use "cli-gopher [command] --help" for more information about a command.
Build binary locally on OSX
CGO_ENABLED=0 go build -ldflags="-X 'github.com/alexbednarczyk/cli-gopher/cmd.version=$(date +%Y.%U.%j)' -w -s" -v -o cli-gopher .
- Golang - Go, the open source programming language
- Cobra - A Commander for modern Go CLI interactions
- go.1password.io/spg - A go package for strong password generation.
- GitHub Actions - Automate your workflow from idea to produciton
This project is licensed under the MIT License - see the LICENSE.md file for details