Commit Graph

37 Commits

Author SHA1 Message Date
edef
031d30c8ac Handle multiple arguments in $PAGER
$PAGER may contain arguments, and should thus be word-split before 
invocation.
2019-12-02 15:15:33 +01:00
Johannes Altmanninger
35115d3d54 __fish_print_help: do not read $LESS 2019-11-07 17:45:54 +01:00
Johannes Altmanninger
97d031e20c reformat 2019-10-28 18:36:07 +01:00
Johannes Altmanninger
61486954bc Use a pager to view long outputs of builtin --help
Every builtin or function shipped with fish supports flag -h or --help to
print a slightly condensed version of its manpage.
Some of those help messages are longer than a typical screen;
this commit pipes the help to a pager to make it easier to read.

As in other places in fish we assume that either $PAGER or "less" is a
valid pager and use that.

In three places (error messages for bg, break and continue) the help is
printed to stderr instead of stdout.  To make sure the error message is
visible in the pager, we pass it to builtin_print_help, every call of which
needs to be updated.

Fixes #6227
2019-10-28 18:36:07 +01:00
Fabian Homborg
bcce6d691f Keep "; and" and "; or" on fish files
This reformats *.fish files from before commit
c2970f9618 with the changes to fish_indent.

[ci skip]
2019-05-05 13:34:38 +02:00
Fabian Homborg
c2970f9618 Reformat all files
This runs build_tools/style.fish, which runs clang-format on C++, fish_indent on fish and (new) black on python.

If anything is wrong with the formatting, we should fix the tools, but automated formatting is worth it.
2019-05-05 12:09:25 +02:00
Aaron Gyes
51e963bf44 fixup last commit 2019-04-21 09:07:29 -07:00
Aaron Gyes
9d84b45256 __fish_print_help: remove indent
Do this lame replacement in order to make some_builtin --help
output less tacky.
2019-04-21 02:06:29 -07:00
Fabian Homborg
25dd22242d Adjust __fish_print_help for sphinx
This is beyond cheesy, but it seems to work.

Fixes #5782.
2019-04-10 18:20:25 +02:00
John McKay
827bce6c88 Use mandoc when nroff not available
mandoc users do not need to install nroff to be able to format and view
manual pages. If both nroff and mandoc cannot be found it will show an
error.
2019-01-08 18:25:28 +01:00
Fabian Homborg
d727e32934 __fish_print_help: Just use $COLUMNS
This had an undocumented internal feature that would pass the tty
width along. Instead, just have it read $COLUMNS, which we always
define anyway.
2018-10-23 15:05:15 +02:00
Peter Ammon
7659554dea Remove use of caret redirection from share/*
This removes the use of caret redirections from share/completions
and share/functions, in preparation for dropping support in fish.
2018-04-01 13:42:38 -07:00
Mahmoud Al-Qudsi
c51abd04ff Clean up $__fish_*dir variable names
Closes #4429
2018-03-12 08:34:20 -05:00
ridiculousfish
a5fd0b317e Revert "Switch to bare vars in our math invocations"
This reverts commit bd18736ee5.

Bare variables should only be used in commands that must
manipulate the variable stack, such as `set`.
2017-09-09 23:35:47 -07:00
Kurtis Rader
bd18736ee5 Switch to bare vars in our math invocations
Using bare vars is more efficient because it makes the builtin `math`
expression cache more useful. That's because if you prefix each var with
a dollar-sign then the fish parser expands it before `math` is run.
Something like `math x + 1` can be cached since the expression is the
same each time it is run. But if you do `math $x + 1` and x==1 then you're
effectively executing `math 1 + 1`. And if x==2 the next time then you're
running `math 2 + 1`. Which makes the expression cache much less effective.
2017-08-24 12:38:10 -07:00
Kurtis Rader
8e87d595b7 remove some uses of $IFS
This is a step towards resolving issue #4156. It replaces uses of `$IFS`
with other solutions.
2017-07-24 20:45:43 -07:00
Kevin Ballard
9bc1b44b0d Handle missing groff macro in __fish_print_help
The Xcode installation of Fish is missing the groff macro used by
`__fish_print_help`. This caused e.g. `status -h` to stop working.

Fixes #4058.
2017-05-23 19:57:18 -07:00
Kurtis Rader
54a76bb9e5 emit error message when test is given invalid int
This augments the previous change for issue #3346 by adding an error
message when an invalid integer is seen. This change is likely to be
controversial so I'm not going to squash it into the previous change.
2016-11-27 20:37:30 -08:00
Kurtis Rader
345950ac1b workaround broken groff man page config
Fixes #2673
2016-10-19 13:43:04 -07:00
Fabian Homborg
222a07e907 Allow compressed man pages in help
It seems Fedora compresses our whopping 340k of man pages.

Fixes #3130.

Inspired by @TieDyedDevil's work there.
2016-06-10 14:13:15 +02:00
Fabian Homborg
158ea98189 Replace uses of expr with math/string 2016-02-03 23:23:59 +01:00
Sanne Wouda
cad1dc5293 Fix #1978:"ul: unknown escape sequence" when asking for help
It seems that `ul` can't handle the escape sequences for bold text that `nroff` generates on my system.  Fixed by either removing `| ul`, or adding `-c` to the `nroff` command.

Needs testing for old (OSX?) versions of nroff.
2015-04-04 12:03:58 -07:00
David Adam
c78e56c509 Update various strings for translation, avoid _ for non-translations
Use __ instead of _ as a placeholder for ignored variables in `read`
statements.
2014-11-25 15:37:30 +08:00
Kevin Ballard
76c6985f82 A little extra tweaking so builtin_print_help looks better
The terminal width magic that __fish_print_help learned doesn't help
when builtin_print_help runs it in a subshell. Instead, add an
undocumented --tty-width flag to __fish_print_help that's used to pass
the terminal width.
2014-10-10 00:11:23 -07:00
Kevin Ballard
ac8c5910eb Rewrite __fish_print_help to produce better results
As a result of this rewrite, the output now:

* Expands to fit the terminal width, like `man` does
* Preprocesses the manpage with `tbl` just in case, since `man` does
  this, even though I doubt any fish manpages use `tbl` formatting.
* Handle bold/underline with the `ul` command as it was designed for
  instead of trying to fake it with `sed`.
* Compresses blank lines as `man` does with the default `less -is`
  pager.
2014-10-09 23:48:10 -07:00
Łukasz Niemier
47df1ae40a Remove trailing whitespaces and change tabs to spaces 2012-11-18 11:23:22 +01:00
ridiculousfish
de5223db66 Improve documentation and error reporting for elseif. 2012-09-01 02:14:13 -07:00
ridiculousfish
60ef7903e2 Tweaked __fish_print_help to not spew errors 2012-07-06 16:31:06 -07:00
ridiculousfish
ee8fd21d28 Fix for https://github.com/fish-shell/fish-shell/issues/209
Don't hang if stdin is closed and we have no bindings
2012-07-06 16:25:59 -07:00
ridiculousfish
ebfa285122 Teach __fish_print_help.fish about the new man path 2012-06-17 14:46:24 -07:00
Grissiom
70322077d2 remove trialing spaces #2 2010-09-18 10:18:26 +08:00
liljencrantz
61ebc12dd4 Minor polish like adding missing whitespace, switch to using --argument switch in function definitions to make code more readable, add a few minor saftey checks, etc.
darcs-hash:20070923210730-75c98-88557ba8b6020cae04a5e437c6bb6370e39c04d9.gz
2007-09-24 07:07:30 +10:00
liljencrantz
0679a6351f Fix bug making builtin help for the '.' builtin not show up.
darcs-hash:20070922223828-75c98-41cf335992cd61ef5c958889714766c513d5d5f7.gz
2007-09-23 08:38:28 +10:00
axel
7492b6cdb3 Make all descriptions for function calls use the implicit translation from the previous patch instead of explicitly using N_
darcs-hash:20070116012918-ac50b-c1c0df64333ad910ca81dbc86ad193ece6680722.gz
2007-01-16 11:29:18 +10:00
axel
125ca9ff73 Minor edits, whitespace fixes, etc.
darcs-hash:20061120131412-ac50b-0d9bc9d3fb35b4c9831bdf3a606e9aa8df844478.gz
2006-11-20 23:14:12 +10:00
axel
372c811763 Support bold and underlined characters in help output
darcs-hash:20061119232734-ac50b-d426980ee143b44065a3ea2afc7d3808174acd5f.gz
2006-11-20 09:27:34 +10:00
axel
1b71f91a01 Update documentation display code to run roff on the client system instead of pregenerating documentation and compiling it into program binaries
darcs-hash:20061117162438-ac50b-5c4c7f0bd8bf53a16e16ecfead9569e642b7160f.gz
2006-11-18 02:24:38 +10:00