Skip to content

Fallback to cmd --help when man cmd errors - #8041

Closed
cljoly wants to merge 1 commit into
fish-shell:masterfrom
cljoly:cljoly/man-help-fallback
Closed

cljoly wants to merge 1 commit into
fish-shell:masterfrom
cljoly:cljoly/man-help-fallback

Conversation

@cljoly

@cljoly cljoly commented Jun 1, 2021

Copy link
Copy Markdown

Description

In __fish_man_page.fish, call cmd --help (resp. cmd sub --help) when man cmd (resp. man cmd-sub) does not exist.

I’m unsure if this is worth adding an entry in CHANGELOG.rst

TODOs:

  • Changes to fish usage are reflected in user documentation/manpages.
  • Tests have been added for regressions fixed
  • User-visible changes noted in CHANGELOG.rst

In __fish_man_page.fish, call `cmd --help` (resp. `cmd sub --help`) when `man cmd` (resp. `man cmd-sub`) does not exist.
@faho

faho commented Jun 1, 2021 •

Copy link
Copy Markdown
Member

Calling the command here in any way is dangerous. If the command does not take --help as an option you've now done something.

E.g. Solaris' killall ignores all arguments and kills all processes (IIRC).

This is not a feature that should be added, sorry!

@faho faho closed this Jun 1, 2021
@faho faho added this to the will-not-implement milestone Jun 1, 2021
@zanchey

zanchey commented Jun 1, 2021

Copy link
Copy Markdown
Member

E.g. Solaris' killall ignores all arguments and kills all processes (IIRC).

Yes. More specifically, it kills all processes belonging to a user, problematic if you are logged in as root. Ask me how I know. routef is another landmine for the unwary.

@cljoly

cljoly commented Jun 1, 2021

Copy link
Copy Markdown
Author

Right, that makes sense.
How would you feel about having a prompt like (the if cmd --help part would be removed):

Do you want to see `cmd --help`? [Y/n]

The main drawback I see is that it makes calls to __fish_man_page blocking for the user.

@zanchey

zanchey commented Jun 2, 2021

Copy link
Copy Markdown
Member

That is not a question that users can give a useful answer to unless they are already sure that the command is safe.

@cljoly

cljoly commented Jun 2, 2021

Copy link
Copy Markdown
Author

That’s a good point.

@github-actions github-actions Bot locked as resolved and limited conversation to collaborators Jun 6, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants