Settings

Theme

Show HN: Shifu – A pure POSIX shell framework to create powerful CLIs

github.com

7 points by ultramann 2 months ago · 2 comments · 1 min read

Reader

The startup I work for has an internal, bash-based, cli that basically amounts to shared aliases with a common entrypoint. As the number of aliases has grown, I've had a desire to group functionality together in subcommands, add more help strings, and have better tab completion. I know I could convert it to, e.g., a python script, but I was curious what was possible if we continued to use bash.

I couldn't find anything that solved those problems without lots of extra machinery. I understand why, shell scripts are generally not long, and focused on a dedicated task; adding cli features to them is mostly unnecessary, many might even discourage it for many valid reasons.

Nonetheless, I considered writing this functionality myself, but that felt like a poor use of company time. So I started toying with what a framework to handle those concerns entirely in shell script would look like on the side. Thus, shifu was born. I've been working on it off and on for about a year, and think I've got a reasonable alpha release, so thought I'd share.

spbuilds 2 months ago

Keeping it in shell instead of rewriting in Python was probably the right call. Once you add a language runtime dependency you lose the “just drop this file in and use it” simplicity.

  • ultramannOP 2 months ago

    Yeah, that was definitely the motivation of putting it in shell in the first place

Keyboard Shortcuts

j
Next item
k
Previous item
o / Enter
Open selected item
?
Show this help
Esc
Close modal / clear selection