https://github.com/emmanuelgautier/go-cli-template
a simple Go CLI (Command Line Interface) template that you can use as a starting point for building your own command-line applications in Go.
https://github.com/emmanuelgautier/go-cli-template
cli cli-template golang golang-examples golang-template template template-project
Last synced: 5 months ago
JSON representation
a simple Go CLI (Command Line Interface) template that you can use as a starting point for building your own command-line applications in Go.
- Host: GitHub
- URL: https://github.com/emmanuelgautier/go-cli-template
- Owner: emmanuelgautier
- License: mit
- Created: 2023-09-24T12:19:43.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2025-12-05T21:21:54.000Z (6 months ago)
- Last Synced: 2025-12-09T11:07:03.890Z (6 months ago)
- Topics: cli, cli-template, golang, golang-examples, golang-template, template, template-project
- Language: Go
- Homepage: https://github.com/emmanuelgautier/go-cli-template
- Size: 43.9 KB
- Stars: 2
- Watchers: 0
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Funding: .github/FUNDING.yml
- License: LICENSE
Awesome Lists containing this project
README
# Go CLI Template
This is a simple Go CLI (Command Line Interface) template that you can use as a starting point for building your own command-line applications in Go. It provides a basic structure and some common features to help you get started quickly.
## Features
- Command-line argument parsing using the [cobra](https://pkg.go.dev/github.com/spf13/cobra) package.
- Simple subcommand support.
- Github Actions workflow
- GoReleaser preconfigured for Docker build, Github Release binaries (multi-archi) builds and snapcraft publishing.
## Usage
1. Clone or download this repository:
```bash
git clone https://github.com/emmanuelgautier/go-cli-template.git
cd go-cli-template
```
2. Build the CLI tool:
```bash
go build -o go-cli-template
```
3. Run the CLI tool with the `--help` flag to see the available commands:
```bash
./go-cli-template --help
```
You should see output similar to the following:
```
A simple Go CLI template.
Usage:
go-cli-template [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
hello Prints a friendly greeting
help Help about any command
Flags:
-h, --help help for go-cli-template
Use "go-cli-template [command] --help" for more information about a command.
```
4. Run the `hello` subcommand:
```bash
./go-cli-template hello --name YourName
```
Replace `YourName` with your actual name. This command will print a greeting.
## License
This Go CLI template is open-source and available under the MIT License. Feel free to use it as a starting point for your own CLI applications. Contributions and improvements are welcome!
## Author
[Emmanuel Gautier](https://www.emmanuelgautier.com/)