Settings

Theme

Show HN: Shellock, a real-time CLI flag explainer for fish shell

github.com

37 points by behnamoh 2 months ago · 16 comments

Reader

j4cobgarby 2 months ago

I just tried it out, nice! It's a useful tool, but the installation process didn't work for me following the steps as written. As it stands:

* The shellock directory must be in ~/Downloads, otherwise the shellock_bindings.fish fails to source it.

* The installation script in the repo didn't work because it tried to symlink shellock_bindings.fish without specifying an absolute path (`~/.config/fish/conf.d/shellock_bindings.fish -> ./shellock_bindings.fish`) -> caused a recursive symlink which broke.

Now I got it working by making sure to place shellock in Downloads (not ideal long term, I often clear my Downloads folder), and manually symlinking the bindings explicitly. It seems to work pretty well!

  • j4cobgarby 2 months ago

    Playing around with a bit more, I think the tool might not be suitable for my use cases. If I try it with the command `gcc -Wall` it thinks that each of W, a, l, (and l), are separate single-character arguments, and therefore fails badly:

    ``` > gcc -Wall -W Unknown flag -a Unknown flag -l Search the library named library when linking. (The second alternative with the library as a separate argument is only for POSIX compliance and is not recom... ```

    Additionally, it is really slow, I suppose because gcc has a huge man page? It is really useful for lots of small commands like ls and find, and things where I often forget parameters. Maybe it could be changed so that I can whitelist only certain commands to trigger the hints?

    • esseph 2 months ago

      From the website:

      Known Limitations

          Some commands with unusual man page formats may not parse correctly
          Commands that open interactive help (like git commit --help opening a pager) require man page fallback
          Combined short flags like -rf are split into individual flags
    • elcapitan 2 months ago

      Or it could cache the parsed manpages or reuse the information that fish already extracts from there for autocompletion?

      • behnamohOP 2 months ago

        I do use caching on the first trigger of a flag. Maybe I'll add a comprehensive manpage "reading" on the first install to speed things up.

        • elcapitan 2 months ago

          That makes sense, or something like `fish_update_completions` that you can call explicitly.

          • behnamohOP 2 months ago

            That also makes sense! I'll think of a good strategy based on these comments and push to main.

  • behnamohOP 2 months ago

    Thanks for your feedback. I'll definitely work on these and update shellock!

    Update: I pushed the changes. Please let me know if you find any other bugs!

elcapitan 2 months ago

Looks like a cool idea - what does it do with more complicated commands, e.g. two commands with a pipe? Does it pick the last part of the pipe?

Ferret7446 2 months ago

I feel like the end for such a tool is fast approaching, as a local model that can figure out all of the correct flags and arguments for anything you want to do, whilst allowing you to examine the command before running and cite all relevant sources if you want, is quickly becoming viable. I wouldn't be surprised if this already exists.

witherk 2 months ago

Nice, I tried looking for something like this but never found anything. Glad to see someone working on it.

TacticalCoder 2 months ago

I read the title too quickly and thought that 12 years later shellshock was making a come back!

  • Bost 2 months ago

    There's nothing wrong with your reading. It's a misleading, clickbaity name at best.

treetalker 2 months ago

Cool! Recommendations for something similar on zsh?

Keyboard Shortcuts

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