TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: What do you use to make CLIs?

11 pointsby mmwtsnover 2 years ago
I am curious what people reach for when writing CLIs these days; specifically what language, libraries (if any), and why?<p>By CLI, I mean any executable program or script like git that supports commands, sub-commands, and POSIX-style flags.<p>I mostly work in Go, and have been happy with the standard library[1] or Cobra[2]. I also write a lot of shell scripts.<p>I thought it would be interesting to see some other approaches.<p>[1]: https:&#x2F;&#x2F;pkg.go.dev&#x2F;flag [2]: https:&#x2F;&#x2F;cobra.dev

14 comments

asicspover 2 years ago
I use a lot of CLI tools, but haven&#x27;t written many for myself. Mostly, aliases&#x2F;functions and some scripts in Bash&#x2F;Python.<p>1) Extract details for command options from man&#x2F;help: <a href="https:&#x2F;&#x2F;github.com&#x2F;learnbyexample&#x2F;command_help&#x2F;blob&#x2F;master&#x2F;ch" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;learnbyexample&#x2F;command_help&#x2F;blob&#x2F;master&#x2F;c...</a><p>2) cut-like syntax for field manipulations with regexp, negative indexing, etc: <a href="https:&#x2F;&#x2F;github.com&#x2F;learnbyexample&#x2F;regexp-cut&#x2F;blob&#x2F;main&#x2F;rcut" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;learnbyexample&#x2F;regexp-cut&#x2F;blob&#x2F;main&#x2F;rcut</a><p>3) Simple calculator using python syntax: <a href="https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;practice_python_projects&#x2F;calculator&#x2F;calc_py_cli.html" rel="nofollow">https:&#x2F;&#x2F;learnbyexample.github.io&#x2F;practice_python_projects&#x2F;ca...</a>
simonblackover 2 years ago
Sorry. Unless I&#x27;m missing something completely, I have to ask: &#x27;Why would you bother to reinvent the wheel?&#x27;<p>If you want something like bash, just use bash. If you want a CLI in a GUI environment, just use &#x27;terminal&#x27;, or&#x27;xterm&#x27; or similar.<p>If you&#x27;re talking about apps that run in a CLI, then the world is your oyster. Use whatever you need depending on what the app requires.<p>If you&#x27;re talking about what language to use, then just use which ever language that you&#x27;re comfortable with that can&#x2F;will produce a text output.
wizwit999over 2 years ago
Oclif is pretty nice for NodeJS, we use it for <a href="https:&#x2F;&#x2F;github.com&#x2F;matanolabs&#x2F;matano" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;matanolabs&#x2F;matano</a> . <a href="https:&#x2F;&#x2F;github.com&#x2F;charmbracelet&#x2F;bubbletea" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;charmbracelet&#x2F;bubbletea</a> looks really beautiful, if you use Go.
jathuover 2 years ago
I made fx at Flexport, which hosted many of our CLI tools. I liked it a lot, so I made one for myself when I left: <a href="https:&#x2F;&#x2F;github.com&#x2F;jathu&#x2F;fx" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;jathu&#x2F;fx</a><p>fx is a workspace tool manager. It allows you to create consistent, discoverable, language-neutral and developer friendly command line tools.
stop50over 2 years ago
For python i like the builtin argparse.
ezekgover 2 years ago
I use Go and Cobra for my business’s CLI [0]. I like it. Go is pretty unmatched for CLIs.<p>[0]: <a href="https:&#x2F;&#x2F;github.com&#x2F;keygen-sh&#x2F;keygen-cli" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;keygen-sh&#x2F;keygen-cli</a>
FujiAppleover 2 years ago
Rust + Clap: <a href="https:&#x2F;&#x2F;github.com&#x2F;clap-rs&#x2F;clap" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;clap-rs&#x2F;clap</a>
pez_devover 2 years ago
Mostly go whenever shell scripts are not enough.<p>Check out the libraries from charm (charm.sh). They really make the command line glamorous!
marek_leisk2over 2 years ago
<a href="https:&#x2F;&#x2F;typer.tiangolo.com&#x2F;" rel="nofollow">https:&#x2F;&#x2F;typer.tiangolo.com&#x2F;</a>
IceMetalPunkover 2 years ago
I&#x27;m a JavaScript dev, so I tend to go for Node with Inquirer + Commander.
linkddover 2 years ago
Rust + Clap<p>Go + Cobra<p>Python + Click
drakonkaover 2 years ago
I usually turn to Go for all of my CLI needs.
zemover 2 years ago
mostly ruby or python, though I would like to explore ocaml more for the purpose
rurbanover 2 years ago
95% C (with occasional Windows quirks),<p>5% shell.<p>previously lots of perl