cobra
go-flags
cobra | go-flags | |
---|---|---|
136 | 9 | |
38,495 | 2,609 | |
- | - | |
6.9 | 6.5 | |
about 1 month ago | 5 months ago | |
Go | Go | |
Apache License 2.0 | BSD 3-clause "New" or "Revised" License |
Stars - the number of stars that a project has on GitHub. Growth - month over month growth in stars.
Activity is a relative number indicating how actively a project is being developed. Recent commits have higher weight than older ones.
For example, an activity of 9.0 indicates that a project is amongst the top 10% of the most actively developed projects that we are tracking.
cobra
-
Show HN: CREV – A Go-based CLI tool for AI code reviews and codebase exports
- Terminal-Based Workflow: CREV is a CLI tool, removing the need to switch between your editor and the browser.
I have written the CREV CLI tool in Go as I was interested in learning the language and I heard many good things about it’s efficiency and speed. I used https://github.com/spf13/cobra to manage the CLI commands and [Viper](https://github.com/spf13/viper) for handling configurations. This is the first project I have done with Go but I find the language interesting and the Go routines also help with reading in your entire codebase. For the code reviews themselves I use google cloud functions which invoke GPT-4o (am also planning to add Claude 3.5 and GPT-o1).
I’d love to hear your feedback—whether it’s ideas for new features or reasons why you believe this tool is useful or useless to you. I am using it daily so it at least solved my own problem :)
-
Technical Deep Dive: How We Built the Pizza CLI Using Go and Cobra
The Pizza CLI is a Go command-line tool that leverages several standard libraries. Go’s simplicity, speed, and systems programming focus make it an ideal choice for building CLIs. At its core, the Pizza-CLI uses spf13/cobra, a CLI bootstrapping library in Go, to organize and manage the entire tree of commands.
-
Developing CLIs
As we started to flesh out our CLI, we also wanted to test edge cases and detect regressions. I surveyed public cobra/bubbletea based CLIs to look for ideas, and found frustratingly few tests. Then we stumbled upon Charm's teatest which gave us a starting point.
-
Nested Prompts in Go using promptui
I was working on a CLI tool written in Go, using the Cobra tool recently, and I had a use case where I needed a nested prompt for one of the commands. I was using promptui for the prompts and I couldn't find a straightforward way to do this. This short post will show how to create a nested prompt using promptui. The completed code can be found here.
-
Intermediate Go Projects
Cobra Documentation
-
CLI Tools every Developer should know
You can visit the official website for more information on using Cobra: Cobra Documentation
-
The power of the CLI with Golang and Cobra CLI
We can use the flag with --date or -date, Go already does the automatic check. We can make our entire boilerplate with this approach, but let's make it a little easier and use the Cobra CLI package.
-
Build your own curl in Golang
In this tutorial, we'll walk through the process of creating a simple command-line tool similar to curl using Go and Cobra, a CLI library for Go.
-
Scripts should be written using the project main language
I use https://github.com/spf13/cobra religiously for this kind of thing - it handles all the annoying corner cases of parsing flags, and also has an intuitive notion of subcommands (with basic usage/help text generated) for picking which task you want to run with positional arguments.
-
Command Line Interface Guidelines
We recently chose cobra[1] to create a cli application. It comes with so many best practices already packaged like autocompletions, help texts etc. etc.
[1]: https://github.com/spf13/cobra
go-flags
-
Which packages do you recommend for building cli tools?
https://github.com/jessevdk/go-flags provides a pretty neat way to specify flags and handle commands. Not so much extensible as cobra, but good enough for small cli tools
-
Show HN: New set of Go libraries for CLI Development
flags aims to merge the concepts from https://github.com/jessevdk/go-flags, and https://github.com/octago/sflags, both relying on struct tags to define CLI command specs. The flags library uses these underlying concepts to produce complete `cobra.Command` trees, and brings many comfort-of-life improvements for the generated applications/commands.
Console (https://github.com/reeflective/console)
-
Libraries for CLI and console applications
Flags (https://github.com/reeflective/flags) flags aims to merge the concepts from https://github.com/jessevdk/go-flags, and https://github.com/octago/sflags, both relying on struct tags to define CLI command specs. The flags library uses these underlying concepts to produce complete `cobra.Command` trees, and brings many comfort-of-life improvements for the generated applications/commands.
-
Golang equivalent of Python’s click (CLT framework)
go-flags
-
Eclipse: python-fire inspired library to simplify creating CLIs in Go, on top of Cobra
Yeah, I just didn't need the command-subcommand scheme. I used the go-flags test file for examples: https://github.com/jessevdk/go-flags/blob/master/example_test.go
-
Golang - Writing CLI App in Golang with Cobra
There are alternatives available for Cobra as well i.e. mitchellh/cli, go-flags, urfave/cli etc.
-
What are some good open source project to read when learning Go?
https://github.com/jessevdk/go-flags - struct based flag parsing
What are some alternatives?
urfave/cli - A simple, fast, and fun package for building command line apps in Go
kingpin - CONTRIBUTIONS ONLY: A Go (golang) command line and flag parser
cli - CLI - A package for building command line app with go
kong - Kong is a command-line parser for Go
pflag - Drop-in replacement for Go's flag package, implementing POSIX/GNU-style --flags.
mitchellh/cli - A Go library for implementing command-line interfaces.
argparse - Argparse for golang. Just because `flag` sucks