https://github.com/avamsi/climate
"CLI Mate" autogenerates CLIs from structs / functions (nested subcommands, global / local flags, help generation, typo suggestions, shell completion etc.)
https://github.com/avamsi/climate
cli golang library
Last synced: 7 months ago
JSON representation
"CLI Mate" autogenerates CLIs from structs / functions (nested subcommands, global / local flags, help generation, typo suggestions, shell completion etc.)
- Host: GitHub
- URL: https://github.com/avamsi/climate
- Owner: avamsi
- License: unlicense
- Created: 2022-07-13T20:23:58.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-10-07T21:33:49.000Z (about 1 year ago)
- Last Synced: 2024-10-20T20:22:03.770Z (about 1 year ago)
- Topics: cli, golang, library
- Language: Go
- Homepage: https://pkg.go.dev/github.com/avamsi/climate#section-documentation
- Size: 194 KB
- Stars: 147
- Watchers: 3
- Forks: 3
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
- awesome-cli-frameworks - climate
README
# Climate
Climate "CLI Mate" aims to make creating CLIs in Go easy (and fun!), similar to
[python-fire](https://github.com/google/python-fire).
It's also built on top of [Cobra](https://github.com/spf13/cobra) and so comes
with "batteries included" (help, shell completion etc.).
## Usage
https://github.com/avamsi/climate/blob/3aef84cce318eaf6af6c2684002196e635faf4a5/cmd/examples/greet/main.go#L11-L54
```
$ greet --help
Greet someone.
Usage:
greet [opts]
Flags:
-g, --greeting string (default Hello) greeting to use
-n, --name string (default World) name to greet
-t, --times int number of times to greet
-h, --help help for greet
-v, --version version for greet
```
### Subcommands
https://github.com/avamsi/climate/blob/3aef84cce318eaf6af6c2684002196e635faf4a5/cmd/examples/jj/main.go#L14-L87
```
$ jj --help
Jujutsu (an experimental VCS).
Usage:
jj [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
git Commands for working with the underlying Git repo
help Help about any command
init Create a new repo in the given directory
squash Move changes from a revision into its parent
util Infrequently used commands such as for generating shell completions
version Display jj's version information
Flags:
-R, --repository path path to the repo to operate on
--ignore-working-copy don't snapshot / update the working copy
-h, --help help for jj
-v, --version version for jj
Use "jj [command] --help" for more information about a command.
```
```
$ jj git --help
Commands for working with the underlying Git repo.
Usage:
jj git [command]
Available Commands:
export Update the underlying Git repo with changes made in the repo
remote Manage Git remotes
Flags:
-h, --help help for git
Global Flags:
--ignore-working-copy don't snapshot / update the working copy
-R, --repository path path to the repo to operate on
Use "jj git [command] --help" for more information about a command.
```