5 ms·
With fish, if the program you're interested in hasn't betrayed the decades-old tradition of shipping man pages, it's often as simple as running `fish_update_com
by homebrewer 1y ago
With fish, if the program you're interested in hasn't betrayed the decades-old tradition of shipping man pages, it's often as simple as running `fish_update_completions`.
It parses all man pages on your system and generates completion files for you. By default, they go into ~/.cache/fish/generated_completions/*
If the man page was written poorly/is missing, you can always write your own completion (and hopefully send it upstream). fish uses such a simple format that I don't think there's any need for tutorials save the official doc:
https://fishshell.com/docs/current/completions.html https://fishshell.com/docs/current/completions.html
For example, here's an excerpt from curl
complete --command curl --short-option 'L' --long-option 'location' --description 'Follow redirects'
complete --command curl --short-option 'O' --long-option 'remote-name' --description 'Write output to file named as remote file'
- btreecat 1y agoWhen I screen share, people don't realize I'm not using zsh and dozen plugins. It's just fish and it's beautiful out of the box.
- kekebo 1y agoThank you for the comment. https://github.com/umlx5h/zsh-manpage-completion-generator https://github.com/umlx5h/zsh-manpage-completion-generator appears to adapt this to ZSH. Have yet to try through
- cb321 1y agoFor those programs that have betrayed shipping man pages, instead say relying only on a --help system, do you happen to know if the fish shell has an analogue to Zsh `_gnu_generic` and Bash `complete -F _longopt`? If not, do you have any insight into why not/what it would take to make that happen?
- nikita2206 1y agoThe OP mentions them in the last part of their comment, there is `complete …` commands for registering completions
- cb321 1y agoIt sounds like you don't know how the Bash/Zsh ideas I mentioned work. They run the command with --help, parse the output, and from that generate the completions, wiring them in to the completion system. That method is a zero config solution (well, you might need a list of such "command-names only" - no option names, which could change at any time -- so maybe "minimal config"). The OP & you mention a much heavier config solution which strikes me as against the vibe of Fish in general which is, supposedly, out-of-the-box niceness.
- mr_mitm 1y agoAt least for a subset of Python CLI programs, I wrote this: https://github.com/AdrianVollmer/pycompgen https://github.com/AdrianVollmer/pycompgen Still in an early stage, but it should work.
- jnpnj 1y agooh wow, it's parsing all 9461 man pages on my arch install, for a cute total of 13MB thanks a lot
- sanewombat 1y agoIt's surprising that on OpenSUSE `zypper search fish-completion` returns more than 200 packages. Something is fishy here.
- OptionOfT 1y agoThat is to get live data in your completions. Say you have a widget that has 3 commands: list, start and stop. With one of those completion files widget stop <tab> will show you a tab-able list of widgets which are running.
- IgorPartola 1y agoman pages are so underrated. I mean every project nowadays has README.md so I don’t see why we can’t just auto generate them with or without an LLM helping. Also I wish programs would use standardized generic arguments for help, config file, version, background the task, PID file, log file, and log level.
- yencabulator 1y agoI'll switch to fish after it stops expanding `car TAB` to `blkdiscard` when I don't have `cargo` in path. Non-prefix completion for commands is plain evil.
- dingnuts 1y agoI bet this is configurable but I wanted to say that this is totally personal preference; I have the exact opposite opinion. Prefix only matching requires much more tab slapping in my experience.
- yencabulator 1y agoI believe you would lose that bet. I look every few years and I don't see it
- natebc 1y agointerestingly this also seems to have come up pretty recently in their discussions. https://github.com/fish-shell/fish-shell/discussions/11670#discussioncomment-13904580 https://github.com/fish-shell/fish-shell/discussions/11670#d... > I'm not sure that subsequence matching ever produces results that people expect (I feel like we've discussed this before but haven't had time to go digging) No solution, but the discussion seems positive, from a maintainer too.
- thiht 1y agoI gave up on fish after a few weeks because of a similar preference issue where the fish maintainers flat out refused to make a bad default configurable: https://github.com/fish-shell/fish-shell/issues/8618 https://github.com/fish-shell/fish-shell/issues/8618 > We don't really do config flags like this, as a philosophical point. > I would be against accepting such a PR. I do not believe this should be changed. I understand that they want to keep the list of configs short and manageable, but it means that's not a tool for me. I'm all for good, opinionated defaults but I want to be able to make some changes if I want to. They apparently reconsidered and implemented the change since migrating fish to rust though.
- fishywang 1y agoI tried to use fish on some of my debian servers that i only rarely update packages/kernel, so I don't have to carry my bashrc there, but found their completion for apt is pretty naive. for example after updated kernel i would want to clean up the old ones, but `apt purge linux-image-<TAB>` would list all available kernel versions, not just the ones currently installed. in the end i switched back to bash.
- hnlmorg 1y agoFish isn’t the only shell that does this. Murex has supported man page completions for years too. And it’s fully automatic in Murex.