c-blake/cligen
View on GitHub ↗ ★ 584 Nim
Nim library to infer/generate command-line-interfaces / option / argument parsing; Docs at
57 mentions on Hacker News by 8 people: 1 story, 56 comments · first 2018-08-17 · latest 2026-10-13
20082026
-
…has nice compile-time introspection and very low effort macros to allow packaging near zero-code APIs like github.com/c-blake/cligen. Also, something like 5 out of 5 times I've investigated some Rust alternative to some Nim code, the Rust…
comment by cb321 · 2026-10-13 · in 11 year old unsoundness bugs found in Rust borrow checker -
One application of such a feature would be something like a "cligen.c3" (like the Nim https://github.com/c-blake/cligen or its /python/cg.py port or etc.). Mostly it just seems a more complete signature extraction, though. Any other kind…
comment by cb321 · 2026-01-03 · in The C3 Programming Language -
Even better, in Nim these little CLI tools could use https://github.com/c-blake/cligen and have had terminal colorized, auto-generated help for many years now with much less dev-effort than raw argparse. Start-up time of statically linked…
comment by cb321 · 2025-10-10 · in Python 3.14 is here. How fast is it? -
…is a stab at an auto-generation framework from said data for the Nim CLI toolkit, cligen, over at: https://github.com/c-blake/cligen/blob/master/util/complgen.... but it only works for Zsh right now. Anyway, I don't think perfect should be…
comment by cb321 · 2025-08-10 · in Writing simple tab-completions for Bash and Zsh -
…said colorization if NO_COLOR[1] is set then you can prefix _gnu_generic with NO_COLOR=1 as in https://github.com/c-blake/cligen/wiki/Zsh-completion-for-cl... for the cligen Nim CLI toolkit. A similar thing in Bash is `complete -F _longopt…
comment by cb321 · 2025-08-10 · in Writing simple tab-completions for Bash and Zsh -
…subthread in one of the hundreds of closed issue threads got into a comparison of dups and jdupes ( https://github.com/c-blake/cligen/issues/99#issuecomment-485... ) where Jody shows up. I mean, in my test cases dups fared well, but on…
comment by cb321 · 2025-08-07 · in Cligen: A Native API-Inferred Command-Line Interface Generator for Nim -
…usable and, I bet @cb321 will confirm, in some cases are competitive with widely-used alternatives. https://github.com/c-blake/cligen/tree/master/examples
comment by ZoomZoomZoom · 2025-08-07 · in Cligen: A Native API-Inferred Command-Line Interface Generator for Nim -
▲ 6
Cligen: A Native API-Inferred Command-Line Interface Generator for Nimstory by TheWiggles · 2025-08-07 · 3 comments
-
…the value. Then you can say `cut -d:=` or `cut -d=:` if you wanted to use either one. This is what https://github.com/c-blake/cligen does (for Nim, not Go).
comment by cb321 · 2025-03-23 · in argp: GNU-style command line argument parser for Go -
Another example applying compile-time reflection is something like https://github.com/c-blake/cligen { but it helps if your host prog.lang has named parameters like Python's foo(a=1, b=2) }.
comment by cb321 · 2025-01-07 · in Zig's comptime is bonkers good -
https://github.com/c-blake/cligen makes whipping up CLI utilities very easy in Nim with a pretty fancy CL-user experience (colorized, user-tunable --help, Zsh/bash completions, brief long options, spellcheck/autosuggest on typos, etc.). As…
comment by cb321 · 2024-09-07 · in My first experience with Gleam Language -
When making small Nim programs for the CLI, https://github.com/c-blake/cligen makes for a pretty simple API (just 1 line of code) that gets you nice CLI syntax, color auto-generated help messages, etc.
comment by cb321 · 2024-08-22 · in Ask HN: Which alternative to Python for personnal use would you recommend? -
…the 2 `var`s and change `print` -> `echo`. { EDIT: though if you love Py print(), there is always https://github.com/c-blake/cligen/blob/master/cligen/print.n... or some other roll-your-own idea. Then instead of py2/py3 print x,y vs…
comment by cb321 · 2024-08-09 · in Recent Performance Improvements in Function Calls in CPython -
…it is not as full-featured as stdlib `string`, there is a zero-copy `cligen/mslice.MSlice` type ( https://github.com/c-blake/cligen/blob/master/cligen/mslice.... ) that does have basic features like splitting and number parsing. There are…
comment by cb321 · 2024-03-30 · in Garbage collection for systems programmers (2023) -
There is also generating the whole thing from a function signature (e.g. https://github.com/c-blake/cligen ) since then CLauthors need not learn a new spec language, but then CLauthors must add back in helpful usage metadata/semantics and…
comment by cb321 · 2024-01-12 · in CLI user experience case study -
cligen also allows End-CL-users to adjust colorization of --help output like https://github.com/c-blake/cligen/blob/master/screenshots/di... using something like https://github.com/c-blake/cligen/wiki/Dark-BG-Config-File Last I knew, the…
comment by cb321 · 2023-10-25 · in Things I've learned about building CLI tools in Python -
…take a look at Nim: https://nim-lang.org . Nim has cligen library to generate and parse arguments: https://github.com/c-blake/cligen And to prove what Nim's capable of - here's a cool repo with 100+ cli apps cligen author wrote in Nim:…
comment by archargelod · 2023-10-25 · in Things I've learned about building CLI tools in Python -
…54 environment variables. The program only does about 17 system calls total, though. Additionally, https://github.com/c-blake/cligen makes decent CLI tools a real breeze. If you like some of Go's qualities but the language seems too…
comment by cb321 · 2023-09-11 · in Removing garbage collection from the Rust language (2013) -
…this article interesting and are curious about Nim then you would probably also be curious about https://github.com/c-blake/cligen That allows adding just 1-line to a module to add a pretty complete CLI and then a string per parameter to…
comment by cb321 · 2023-09-06 · in Writing Small CLI Programs in Common Lisp (2021) -
…for C, even Windows has popen these days. There are also some tiny Nim popenr/popenw wrappers in https://github.com/c-blake/cligen/blob/master/cligen/osUt.ni... covering the Windows case. Depending upon how balanced work is on either side…
comment by cb321 · 2023-08-22 · in GNU Parallel, where have you been all my life? -
…code to then generate related/translated ASTs to create nearly frictionless helper facilities like https://github.com/c-blake/cligen . You can do all of this without any real run-time speed sacrifices, depending upon the level of effort…
comment by cb321 · 2023-08-12 · in The Bipolar Lisp Programmer (2007) -
…bu page. Regarding cligen, right from the start clap wins on producing idiomatic output. Compare: https://github.com/c-blake/cligen#cligen-a-native-api-inferr... Usage: fun [optional-params] [args: string...] An API call doc comment…
comment by joshka · 2023-06-28 · in Ask HN: Why did Nim not catch on like Rust did? -
…and I realize your post was more about "why Rust?" rather than "why not Nim?", but that said the https://github.com/c-blake/cligen Nim CLI framework seems much lower effort / ceremony than even Rust's `argh` and is just about as old as…
comment by cb321 · 2023-06-27 · in Ask HN: Why did Nim not catch on like Rust did? -
…about adoption, IMO. "Performant" has many dimensions. That said, I just tested the Nim https://github.com/c-blake/cligen vs clap: cligen used 5X less object file space (with all size optimization tweaks enabled in both), 20% less run-time…
comment by cb321 · 2023-03-30 · in Zig and Rust -
…in files or use a SHA256 of a content-based first slice. ( There are edit distance algos in Nim in https://github.com/c-blake/cligen/blob/master/cligen/textUt.... as well as in https://github.com/c-blake/suggest ). Or, you could do a…
comment by cb321 · 2023-03-07 · in Self-Host All the Things? -
…and probably N others. Personally, I prefer Nim to Python which has https://github.com/c-blake/cligen . As mentioned in https://github.com/c-blake/cligen/blob/master/MOTIVATION.md , but not in the borretti article, the overhea
comment by cb321 · 2023-02-08 · in Shells are two things -
…is perfect, there is much to recommend it. By now I've written over 150 command-line tools with https://github.com/c-blake/cligen . A few are at https://github.com/c-blake/bu or https://github.com/c-blake/nio { screw 1970s COBOL-esque SQL…
comment by cb321 · 2023-01-03 · in Offensive Nim -
…macro system can (some of the time) get you similar powers to Python's dynamic reflection. E.g., https://github.com/c-blake/cligen instead of `autocommand` or `click` or `argh` or you name the automatic CLI generator, only with full C-like…
comment by cb321 · 2022-12-30 · in Why I'm still using Python -
…to such nice conveniences and are willing to learn Nim, I might then recommend something more like https://github.com/c-blake/cligen
comment by cb321 · 2022-12-27 · in Programs are dead, and JavaScript has killed them -
…found this slower-than-C to be the case. You may need to use something like `iterator getDelims` in https://github.com/c-blake/cligen/blob/master/cligen/osUt.ni... to manage memory with fewer copies/less alloc "more like C", though or…
comment by cb321 · 2022-11-11 · in A cost model for Nim -
…that just receive a parsed AST. That can be used to "re-parse" or "re-compile" external code as in https://github.com/c-blake/cligen . So, trade-offs like in all of life. There is even a book called The Paradox Of Choice [1]. I think there…
comment by cb321 · 2022-11-11 · in A cost model for Nim -
Re CLIs in Nim..Most find https://github.com/c-blake/cligen easy to use.
comment by cb321 · 2022-10-26 · in Python 3.11 is faster than 3.8 -
https://github.com/c-blake/cligen can make the CLI integration part pretty frictionless.
comment by cb321 · 2022-06-17 · in This Month with Nim: April and May 2022 -
…ps (Linux-only right now). It has a more canonical CLI since it is based upon the Nim CLI generator https://github.com/c-blake/cligen . It also uses cligen's subcommand feature (display, find, scrollsys) and so it can replace pgrep, pkill,…
comment by cb321 · 2022-05-07 · in Unix command line conventions over time -
…Nim is suitable or teaching people introductory programming, though. [1] https://nim-lang.org/ [2] https://github.com/c-blake/cligen/blob/master/cligen/dents.n... [3] https://app.element.io/#/room/#nim-science:envs.net [4]…
comment by cb321 · 2022-03-18 · in Python 3 Types in the Wild -
rp looks like a very interesting and clever approach. I'll have to take a closer look. Is https://github.com/c-blake/cligen/blob/master/examples/rp.ni... the extent of rp's documentation?
comment by benhoyt · 2022-02-03 · in Optimizing GoAWK with a bytecode compiler and virtual machine -
…(EDIT: Awk is fairly well established, of course.) [1] https://forum.nim-lang.org/ [2] https://github.com/c-blake/cligen/blob/master/examples/rp.ni... [3] https://repo.or.cz/w/tinycc.git
comment by cb321 · 2022-02-03 · in Optimizing GoAWK with a bytecode compiler and virtual machine -
…(Min time of 10 runs with the git repo housed by /dev/shm on Linux 5.15.) The "simple" code is in https://github.com/c-blake/cligen/blob/master/cligen/dents.n... (just `dents find` does not require the special kernel batch system call…
comment by cb321 · 2021-11-21 · in Git ls-files is Faster Than Fd and Find -
This is roughly how https://github.com/c-blake/cligen/blob/master/examples/dups.... can work. There is little question that changing the scale of the problem very much lessons performance sensitivity to the hash.
comment by cb321 · 2021-10-29 · in Meow Hash (2018) -
…at the problem) ever so slightly another answer exists in this space and is quite easy. :-) [1] https://github.com/c-blake/cligen/blob/master/examples/rp.ni...
comment by cb321 · 2021-09-07 · in Awk: The Power and Promise of a 40-Year-Old Language -
…to recap. Weave [4] would be a good place to start reading, though, or searching the Nim Forum. [1] https://github.com/c-blake/cligen/blob/master/cligen/procpool.nim [2] https://github.com/c-blake/cligen/blob/master/examples/grl.nim [3]…
comment by cb321 · 2021-05-15 · in Nim 2.0 thoughts -
…And if you like colors, hldiff [3] is not a terrible example. [1] https://nim-lang.org/ [2] https://github.com/c-blake/cligen [3] https://github.com/c-blake/hldiff
comment by cb321 · 2021-03-17 · in Writing Small CLI Programs in Common Lisp -
…types like macros, templates, etc., even the ones named like an operator such as `<`). [1] https://github.com/c-blake/cligen
comment by cb321 · 2021-03-12 · in Patten Matching in Nim -
…bugs/things to workaround (as with any language), but Nim has been pretty usable for years. [1] https://github.com/c-blake/cligen
comment by cb321 · 2021-02-22 · in Go is not an easy language -
…or so with Nim than you would with Rust. Nim really seems to "scale up gracefully" for most. [1] https://github.com/c-blake/cligen [2] https://news.ycombinator.com/item?id=25596285
comment by cb321 · 2020-12-31 · in Nim in 2020: A Short Recap -
…That is an alternate, perhaps more keystroke-heavy solution to the problem bothering @simias. [1] https://github.com/c-blake/cligen/blob/master/cligen/macUt.n...
comment by cb321 · 2020-12-23 · in Nim Apocrypha, Vol. I