The Donald Trump: New top story on Hacker News: Ask HN: Any tool for managing large and variable command lines?

Thursday 25 April 2024

New top story on Hacker News: Ask HN: Any tool for managing large and variable command lines?

Ask HN: Any tool for managing large and variable command lines?
12 by bjackman | 13 comments on Hacker News.
I often find myself building up big complex command lines for testing my code, which live in my shell history. Sometimes it's possible to just wrap these up in scripts but often my invocations of that script get so variable that I need many flags etc and now the commandline gets really long and I'm back at square one. A little hard to describe in the abstract so here's a present example: - I wanna compile a kernel and boot it up in QEMU, then SSH into it. - But sometimes, I wanna skip the build (it takes a few seconds to detect that the tree is unchanged) - Sometimes, I wanna boot with a different special disk file. - Sometimes, I wanna change the networking setup. Sometimes this requires me to charge the part of the commandline that SHH's into the VM, to match the changes I made to the QEMU commandline. - etc etc So I just have a huge command line in my shell history and I bring it up and manually edit it each time. But I think it's possible to make this process more convenient. An inspiration for this is Magit, an Emacs plugin that allows (among many other things) building up and stringing together lots of complex git commandlines with varying flags, via a few keypresses in a discoverable text UI. I wonder if something like this already exists? If not I think it could be a fun design challenge. By looking at the shell history and using heuristics about common CLI design patterns perhaps you could automatically create keyboard shortcuts.

No comments:

Post a Comment