HackerReposA FIELD GUIDE TO OPEN SOURCE
ProSponsor the shelf♧ 0
← Back to top all-time
spf13
cobra
Go2015–2026
spf13 / cobra

cobra

A Commander for modern Go CLI interactions

40Distinct people
42Mentions
0Explicit recommenders
44.8KGitHub stars
REPOSITORY AT A GLANCE

What to know before exploring

What it is

A Commander for modern Go CLI interactions

GitHub

Where it is used

No documented product use was verified in the last source check.

What people are saying

No recommendation phrase was found in the indexed comments.

No classified warning is attached to this page. Read the discussions before treating silence as approval.

Also in these discussions

Mentioned in the same Hacker News threads. That is not proof they are substitutes.

This week on Hacker News

Nov 7–Nov 14 UTC · Direct repository links and separately labeled related project stories. Indexed through 11/14/2026, 3:03:16 PM UTC.

No direct repository links were found in the indexed HN discussions over the past seven days. Older discussions are available below.

Mentions over time

HN mentions by year42 dated mentions

Observed mentions: 2015-01-03 00:09:24 UTC to 2026-01-14 14:05:20 UTC.

024682015-01-01 00:00:00 UTC to 2016-01-01 00:00:00 UTC (exclusive): 1 mentions; 0 submissions, 1 comments20152016-01-01 00:00:00 UTC to 2017-01-01 00:00:00 UTC (exclusive): 2 mentions; 1 submissions, 1 comments2017-01-01 00:00:00 UTC to 2018-01-01 00:00:00 UTC (exclusive): 0 mentions; 0 submissions, 0 comments2018-01-01 00:00:00 UTC to 2019-01-01 00:00:00 UTC (exclusive): 4 mentions; 1 submissions, 3 comments2019-01-01 00:00:00 UTC to 2020-01-01 00:00:00 UTC (exclusive): 6 mentions; 0 submissions, 6 comments2020-01-01 00:00:00 UTC to 2021-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments20202021-01-01 00:00:00 UTC to 2022-01-01 00:00:00 UTC (exclusive): 5 mentions; 1 submissions, 4 comments2022-01-01 00:00:00 UTC to 2023-01-01 00:00:00 UTC (exclusive): 8 mentions; 2 submissions, 6 comments2023-01-01 00:00:00 UTC to 2024-01-01 00:00:00 UTC (exclusive): 2 mentions; 0 submissions, 2 comments2024-01-01 00:00:00 UTC to 2025-01-01 00:00:00 UTC (exclusive): 3 mentions; 1 submissions, 2 comments2025-01-01 00:00:00 UTC to 2026-01-01 00:00:00 UTC (exclusive): 5 mentions; 0 submissions, 5 comments2026-01-01 00:00:00 UTC to 2027-01-01 00:00:00 UTC (exclusive): 1 mentions; 1 submissions, 0 comments. Incomplete calendar period.2026*

* An incomplete calendar period is marked with an outlined bar. Its count is not directly comparable with a full period.

Counts come from the repository’s dated source evidence. Index cutoff: 2026-11-02 08:16:59 UTC.

View mention counts and date ranges
UTC ranges include their start and exclude their end. Select a period to filter the source evidence.
PeriodStart (UTC)End (exclusive, UTC)MentionsSubmissionsComments
20152015-01-01 00:00:00 UTC2016-01-01 00:00:00 UTC101
20162016-01-01 00:00:00 UTC2017-01-01 00:00:00 UTC211
20172017-01-01 00:00:00 UTC2018-01-01 00:00:00 UTC000
20182018-01-01 00:00:00 UTC2019-01-01 00:00:00 UTC413
20192019-01-01 00:00:00 UTC2020-01-01 00:00:00 UTC606
20202020-01-01 00:00:00 UTC2021-01-01 00:00:00 UTC505
20212021-01-01 00:00:00 UTC2022-01-01 00:00:00 UTC514
20222022-01-01 00:00:00 UTC2023-01-01 00:00:00 UTC826
20232023-01-01 00:00:00 UTC2024-01-01 00:00:00 UTC202
20242024-01-01 00:00:00 UTC2025-01-01 00:00:00 UTC312
20252025-01-01 00:00:00 UTC2026-01-01 00:00:00 UTC505
2026 (partial)2026-01-01 00:00:00 UTC2027-01-01 00:00:00 UTC110

What Hacker News says

42 sources

Show HN: Convert Go to Rust

I announce rinku to the world! With people looking less and less at code, why not choose a language with better runtime characteristics instead of the one you wanted to write code in before? As a Go coder I have migrated several of my small tools to Rust, as Rust is faster, uses less memory and has no GC latency (wish Go had arenas). The main obstacle was mapping third party dependencies like open source libraries. As a solution I have created 'rinku'. You give it a Go dependency and it gives you a Rust dependency. > $ rinku lookup https://github.com/spf13/cobra > https://github.com/clap-rs/clap Prompt now becomes (real prompt is more complicated) > Translate the project from Go to Rust. For dependencies migration use rinku. The library of mappings is not yet extensive, but migration is now much easier. https://github.com/marvai-dev/rin
Read the rest
1 points · Open discussion
Oh fun. Since this pokes at LLM I'll share my use case from last week. I built a similar(ish) tool locally (for personal use) as a CLI with an LLM. I download transactions from my bank and credit card, have it load them into a sqlite database, do some transformations (categorizing, grouping, excluding), and bottle up each command as a cli sub-command or flag. I used go, cobra, and the charm libs (to help with interactive labeling). I spent about a day on it to get it roughly usable, so I can drop in my updated transactions next month and get a basic report. Since the output is sqlite database and cli commands, I can also use claude code to ask it stuff, which was interesting because my original plan was to do all the asking myself and just have claude build the cli tool. It works decently. I got out what i needed and fought very very hard
Read the rest
to not go more all in / code dive, etc. I just needed my monthly expense totals, ordered, with some clean-up. The code is so-so, but it mostly got things working in a few shots. Claude being able to iteratively run commands / issue queries while it worked was key to it getting functional, I think. I love that it runs local and spits out plain text for tables and such; to share with my wife i copy pasted some of the output to a text document then added some comments (markdown). If I hacked on it more, I'd probably re-work the architecture a bit; I think coming up with a good design about how to ingest idempotently, and then how you want to transform transactions (i.e. in place, vs setting up rules / overrides and then generating a computed transactions table) is most important. After each mini feature having the LLM document its usage in the README, and of course committing, was key. It made it very easy to ditch conversations and start new ones, and point to the README / examples (as opposed to compacting prior conversation). I think your tool at $5 is a great value; I had TONS of fun making the CLI app but it still took me a few hours of focused work in the end spread over a day, and relied on me having very basic prior experience to help steer it. I bet you can charge more while still keeping the product focused / maintenance low, and absolutely think there's a strong need for it -> While I am super tempted to get crazy with my local app and / automating calculations (etc) ultimately just seeing the money in / out, a few categories that I can sum up (groceries, eating out), and the top 15 expenses, that's really all we need to get our budget in place. Kudos on building a real product, esp. on figuring out how to keep it focused, finding the niche, and recognizing the opportunity to capitalize! EDIT: My actual deps list here. require ( github.com/BurntSushi/toml v1.5.0 github.com/charmbracelet/bubbles v0.21.0 github.com/charmbracelet/bubbletea v1.3.5 github.com/charmbracelet/huh v0.7.0 github.com/charmbracelet/lipgloss v1.1.0 github.com/charmbracelet/log v0.4.2 github.com/mattn/go-sqlite3 v1.14.22 github.com/spf13/cobra v1.10.1 )
In Show HN: Write It Down – Personal finance tracker
Here is one of your empty argument being thrown away instead of respected bugs: * https://github.com/spf13/cobra/blob/6dec1ae26659a130bdb4c985... I could explain the single-quote argument quoting error if you were running it on Windows. The Go runtime library does not provide single-quoting on Windows. At all. (This is historically the behaviour of C runtime libraries on Windows, too.) It should be using a proper argument vector and not doing its own command-line parsing on other platforms, though. * https://cs.opensource.google/go/go/+/master:src/os/exec_wind... * https://cs.opensource.google/go/go/+/master:src/os/proc.go;l...
In Fang, the CLI Starter Kit
Very cool about the SEA feature, I haven't seen that before. Thanks for sharing that This is sort of the worst case comparison, but a hello world program in go is 1.5 MiB and the SEA node equivalent is 109 MiB. Obviously as your program becomes more complex that fixed overhead becomes less of an issue but I think it's still a useful comparison. For the packages, the thing I prefer even more so is writing an application with 0 dependencies at all. net/http, net/http/pprof, flag, pprof, etc are all built in and high quality and you can easily build clis/servers with them. Even a really full featured CLI builder package like cobra has just a few transitive deps and gorilla/mux has none: https://github.com/spf13/cobra/blob/main/go.sum https://github.com/gorilla/mux/blob/main/go.mod If I compare that with express.js or commander its a very dif
Read the rest
ferent story (though, in fairness to commander, they all seem to be dev deps). I don't think it's bad per se to have deps, just a different culture. https://news.ycombinator.com/item?id=43935067 kinda beat that horse already though
In Leaving Google
You did a really great job describing the project and documenting it in the README. Congrats. The project looks super clean and professional. That being said, TBH I don't see any real scenario where I would "prototype a CLI". Unlike a GUI where elements can be placed in some places vs others, a CLI is a CLI. For any developer, it would probably take less time to write it directly using one of the libraries listed here : https://bloomberg.github.io/stricli/blog/intro (TS/JS) or https://github.com/spf13/cobra (Go) with stub implementations for commands. The main problem for me is that defining the CLI in a JSON file lacks all the flexibility of code (reusability, etc.).
In Show HN: Protostar – A CLI Prototyping Tool
elpookie·Oct 6, 2024Submission

Show HN: CREV – A Go-based CLI tool for AI code reviews and codebase exports

I’ve recently built CREV, a Go-based CLI tool designed to get AI-powered code reviews from your terminal. The idea came from my frustration with manually copying code into ChatGPT or Claude to get feedback on my projects. Although ChatGPT could provide me with useful suggestions, it lacked the full context of my project, which often resulted in incomplete reviews since it didn’t know my entire directory structure and the content of all the files. I wanted to fix that, while also eliminating the constant switching between VSCode and my browser. So after a month of development, I’m excited to share CREV: - GitHub: https://github.com/vossenwout/crev - Website: https://crevcli.com/ Features: - Full Codebase Export: Exports your entire directory structure and the content of all the files of your project into a single text file. - AI-Powered Co
Read the rest
de Reviews: CREV reviews your bundled codebase and outputs the review as a markdown file. - 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 its efficiency and speed. I used Cobra 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 :)
2 points · Open discussion
Things I can't live without in a new Go project in no particular order: - https://github.com/golangci/golangci-lint - meta-linter - https://goreleaser.com - automate release workflows - https://magefile.org - build tool that can version your tools - https://godoc.org/github.com/ory/dockertest/v3 - run containers for e2e testing - https://github.com/ecordell/optgen - generate functional options - https://golang.org/x/tools/cmd/stringer - generate String() - https://mvdan.cc/gofumpt - stricter gofmt - https://github.com/stretchr/testify - test assertion library - https://github.com/rs/zerolog - logging - https://github.com/spf13/cobra - CLI framework FWIW, I just lifted all the tools we use for https://github.com/authzed/spicedb We've also written some custom linters that might be useful for other folks: https://github.com/authzed/spicedb/t
Read the rest
In How to start a Go project in 2023
I dug around my refs and I was about to recommend https://clig.dev/, but I see you've already found it. It's a great little reference to have when building a CLI. I typically read the code for other CLIs, particularly those written with the framework I'm using. The last framework I used was Cobra [0], and I studied how others did theirs: - https://cs.github.com/?scopeName=All+repos&scope=&q=github.c... [0]: https://github.com/spf13/cobra
In Ask HN: Why is there no specification for Command Line Interfaces?
OP here. There are a few projects that I wasn't able to work into the story that I think are worth a mention (though some of them are in that Awesome Terminals round-up linked in the article). The Cobra library is a huge one: https://github.com/spf13/cobra Other stuff worth a look includes: Tmux: https://github.com/tmux/tmux Kitty: https://github.com/kovidgoyal/kitty Alacritty: https://github.com/alacritty/alacritty I'm sure there's lots of other stuff I don't know about as well.
In A look at various trends shaping the future of the command line
...but that fifth dependency makes all the difference! $ go mod init foo && go get github.com/spf13/cobra && wc -l go.sum 758 go.sum $ go mod init foo && go get github.com/muesli/coral && wc -l go.sum 10 go.sum (Number of lines in go.sum != number of transitive dependencies, of course, but the scale of the difference still hints at how much extra is being pulled into your project.)
In Coral, a Cobra fork with nearly all its features, but only 4 dependencies

Showing the 15 most recent of 42 sources. Enable JavaScript to search and browse every indexed mention.

MAKE YOURSELF AT HOME

A few shortcuts

/
Search the collection
?
Open this guide
Esc
Close dialogs and navigation

Your saved repositories and interests stay in this browser.