Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Allaman/go-cli-skeleton
A minimal but functional skeleton Go CLI application
https://github.com/Allaman/go-cli-skeleton
bootstrap cli go golang http json kong logging skeleton template zerolog
Last synced: 4 months ago
JSON representation
A minimal but functional skeleton Go CLI application
- Host: GitHub
- URL: https://github.com/Allaman/go-cli-skeleton
- Owner: Allaman
- License: mit
- Created: 2022-06-01T21:26:55.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-06-25T13:33:42.000Z (5 months ago)
- Last Synced: 2024-06-25T15:04:13.586Z (5 months ago)
- Topics: bootstrap, cli, go, golang, http, json, kong, logging, skeleton, template, zerolog
- Language: Go
- Homepage:
- Size: 4.05 MB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# Go CLI Skeleton
A skeleton/template for writing Go CLI applications.
## What's included
- global logging via [zerolog](https://github.com/rs/zerolog) (JSON and human friendly)
- simple HTTP client via `net/http` package
- parsing JSON dynamically via [gjson](https://github.com/tidwall/gjson) and via unmarshalling with `structs`
- reading a file
- writing to a file
- reading directory content (optional recursively)
- reading from stdin (e.g. a Linux pipe)
- CLI commands, parameters and flags via [Kong](https://github.com/alecthomas/kong)
- only main package
- [Goreleaser](https://goreleaser.com/) workflow for automatic multi platform binary releases and Dockerhub images (allaman/go-cli-skeleton:latest or tag)## What's not included
- sophisticated HTTP client
- parsing yaml, json, ... files
- modular file structure ([project-layout](https://github.com/golang-standards/project-layout))
- tests 😬```sh
go run . -h
Usage: go-cli-skeletonA minimal skeleton for building CLI apps
Flags:
-h, --help Show context-sensitive help.
-d, --debug Enable debug output
-j, --json-output Log in json formatCommands:
hello
default commandget
GET query to postman-echo and printing responsepost
POST query to postman-echo and printing responsefile read --path=STRING
Read a filefile write --path=STRING
Write a filedir
List all files in a directory (and sub directories)parse
GET query to postman-echo and parsing the responseversion
Show version informationRun "go-cli-skeleton --help" for more information on a command.
```## TODO
- GlobalLog improvement
- include [pterm](https://github.com/pterm/pterm)
- parse yaml/json files