Commit Graph

147 Commits

Author SHA1 Message Date
Fabian Homborg
018f1f7e20 docs: Document the math functions better 2021-03-11 19:46:52 +01:00
David Adam
c402ce0152 docs: note that function --on-variable is not fired for every change
As discussed in #7735.
2021-02-28 21:24:22 +08:00
David Adam
3e8e864c7c docs: note job expansion in bg/fg/jobs arguments
Discussed in #5019.
2021-02-28 20:56:23 +08:00
David Adam
e9ec95f875 docs: minor updates to math documentation
Closes #7734.
2021-02-21 21:34:15 +08:00
Ethel Morgan
5a0aa7824f Saturate exit codes to 255 for all builtins
After commit 6dd6a57c60, 3 remaining
builtins were affected by uint8_t overflow: `exit`, `return`, and
`functions --query`.

This commit:
- Moves the overflow check from `builtin_set_query` to `builtin_run`.
- Removes a conflicting int -> uint8_t conversion in `builtin_return`.
- Adds tests for the 3 remaining affected builtins.
- Simplifies the wording for the documentation for `set --query`.
- Does not change documentation for `functions --query`, because it does
  not state the exit code in its API.
- Updates the CHANGELOG to reflect the change to all builtins.
2021-02-13 08:41:51 +01:00
Ethel Morgan
6dd6a57c60 Saturate return value in builtin_set_query
builtin_set_query returns the number of missing variables. Because the
return value passed to the shell is an 8-bit unsigned integer, if the
number of missing variables is a multiple of 256, it would overflow to 0.

This commit saturates the return value at 255 if there are more than 255
missing variables.
2021-02-08 20:38:56 +01:00
Fabian Homborg
c8a91cb067 docs: Fix link in bind
Found while replacing links with :ref: roles, which are checked.
2021-02-05 20:19:28 +01:00
Fabian Homborg
b70600e070 docs: Remove errant space 2021-02-05 17:11:29 +01:00
Michael Jarvis
496d7c44a1 Fix sphinx doc warning
~/src/fish-shell/doc_src/cmds/argparse.rst:103: WARNING: Literal block ends without a blank line; unexpected unindent.
~/src/fish-shell/doc_src/cmds/argparse.rst:103: WARNING: Literal block ends without a blank line; unexpected unindent.
2021-02-05 11:07:58 +01:00
Fabian Homborg
3eef295990 docs/argparse: Remove more of the vestigial shortopt mentions
It should only be mentioned as a backwards-compatibility measure,
because it is useless - not even the short flag variable is set.
2021-02-03 19:13:53 +01:00
Fabian Homborg
d2d18e2a6a docs: Remove references to read history
This hasn't been kept since #5904 in 3.1.0.
2021-02-02 09:42:57 +01:00
Fabian Homborg
bb1aa5e72f docs: Make more code lines shorter 2021-02-02 08:35:38 +01:00
Fabian Homborg
8bb3d1198f docs: Make code lines shorter 2021-02-02 08:29:31 +01:00
Fabian Homborg
594d51e7eb Add a separate --profile-startup option to profile startup
This goes to a separate file because that makes option parsing easier
and allows profiling both at the same time.

The "normal" profile now contains only the profile data of the actual
run, which is much more useful - you can now profile a function by
running

   fish -C 'source /path/to/thing' --profile /tmp/thefunction.prof -c 'thefunction'

and won't need to filter out extraneous information.
2021-01-29 20:46:34 +01:00
Fabian Homborg
b489137fa9 docs: Link to fish_key_reader 2021-01-09 13:13:48 +01:00
David Adam
21f46181d9 string match: reword the named capture group documentation 2021-01-08 21:16:07 +08:00
Fabian Homborg
6eeb8861e7 Add exit bind function
Currently binding `exit` to a key checks too late that it's exitted,
so it leaves the shell hanging around until the user does an execute
or similar.

As I understand it, the `exit` builtin is supposed to only exit the
current "thread" (once that actually becomes a thing), and the
bindings would probably run in a dedicated one, so the simplest
solution here is to just add an `exit` bind function.

Fixes #7604.
2021-01-04 09:45:34 +01:00
Ilan Cosman
18940ea086
Remove dunderscores from __fish_status_to_signal (#7597)
* Remove dunderscores from __fish_status_to_signal

* Document fish_status_to_signal

* CHANGELOG: Add fish_status_to_signal

* Add string join to fish_status_to_signal documentation example
2021-01-03 15:15:57 +01:00
Fabian Homborg
b43a8688fe docs: Correct argparse on short- options
These aren't exposed as variables at all, so it's just entirely
vestigial now and only kept for backwards compatibility.
2021-01-01 14:22:22 +01:00
Fabian Homborg
57d23c390b docs: Reword argparse a bit
In particular use "variable" instead of "var".
2021-01-01 14:03:00 +01:00
Fabian Homborg
7ea8e20623
argparse: Make short flag names optional (#7585)
It was always a bit ridiculous that argparse required `X-longflag` if
that "X" short flag was never actually used anywhere.

Since the short letter is for getopt's benefit, we can hack around
this with our old friend: Unicode Private Use Areas.

We have a counter, starting at 0xE000 and going to 0xF8FF, that counts
up for all options that don't have a short flag and provides one. This
gives us up to 6400 long-only options.

6.4K should be enough for everybody.
2021-01-01 11:37:25 +01:00
elpres
aaeb7d107c Fixed sentence in fish_hg_prompt docs 2020-12-28 19:39:27 +01:00
ridiculousfish
f61f45748e Document insert-line-under and insert-line-over bindings 2020-12-19 14:32:17 -08:00
Fabian Homborg
6e9364ab50 fish_indent: Change --debug-level to --debug with flog categories
The "debug-level" flag makes little sense since we have no more
debug *levels* left.
2020-12-14 19:36:18 +01:00
Fabian Homborg
6bbb709c5d docs: Simplify regex importing
[ci skip]
2020-12-06 11:32:01 +01:00
Michael Jarvis
eb22a9c4db Reword text, based on suggestion by @zanchey 2020-12-05 15:00:11 -08:00
Michael Jarvis
350714775a Use "*n*\ th" instead
Escaping the space seems to be a better solution.
2020-12-05 15:00:11 -08:00
Michael Jarvis
74915489e3 Fix sphinx-docs warning
When building from source, there is a warning:

     ../doc_src/cmds/string-match.rst:13: WARNING: Inline emphasis
     start-string without end-string.

One fix appears to be putting a space after the epmhasized 'n' character,
e.g., `*n* th` instead of `*n*th`.
2020-12-05 15:00:11 -08:00
Fabian Homborg
720982a3cb string: Quit early if --quiet is satisfied
E.g. if we do `string match -q`, and we find a match, nothing about
the input can change anything, so we quit early.

This is mainly useful for performance, but it also allows `string`
with `-q` to be used with infinite input (e.g. `yes`).

Alternative to #7495.
2020-12-01 18:55:01 +01:00
Fabian Homborg
27039ed46f docs: Double-up "`"
Otherwise sphinx complains "WARNING: Inline emphasis start-string without end-string"

[ci skip]
2020-11-27 19:46:18 +01:00
Fabian Homborg
5872f4522d math: Add --base option
Currently a bit limited, unfortunately printf's `%a` specifier is
absolutely unreadable.

So we add `hex` and `octal` with `0x` and `0` prefixes respectively,
and also take a number but currently only allow 16 and 8.

The output is truncated to integer, so scale values other than 0 are
invalid and 0 is implied.

The docs mention this may change.
2020-11-27 19:33:27 +01:00
Mahmoud Al-Qudsi
f172b215cf Add documentation for regex import 2020-11-26 14:41:31 -06:00
Fabian Homborg
4ef6490a26 docs: Some fixes to the erase section of set's exit status
[ci skip]
2020-11-20 16:09:24 +01:00
Fabian Homborg
ad138ecef8 docs: Document sets $status peculiarities harder
[ci skip]
2020-11-20 16:07:22 +01:00
Fabian Homborg
9c2d22e452 Remove debug_stack_frames
This was unused with FLOG. We leave the option stubbed out for now, so
we don't error out for well-meaning calls.
2020-11-15 11:32:52 +01:00
Marcus Atilius Regulus
7b9c1a6076 escape a backslash (in 2 places) in argparse docs 2020-11-13 14:27:12 +01:00
Fabian Homborg
5ae7be1603 docs: Add fish_title and fish_greeting 2020-10-28 17:44:45 +01:00
Johannes Altmanninger
4081d58577 docs: use monospace for inline code snippets more consistently 2020-10-26 19:25:41 +01:00
Johannes Altmanninger
5ff2d38d4c builtin time: print help on invalid syntax
I always mix up the order with variable assignments.
2020-10-26 19:25:41 +01:00
Charles Gould
f73ee30111 docs: Fix markup for code blocks 2020-10-10 21:49:33 +02:00
Johannes Altmanninger
eca2a8ba55 complete: print completions without the implied -c switch
This switch is no longer necessary when only one command is given.
Internally completions are stored separately for each command,
so we only every print one command name per "complete" line anyway.
2020-10-10 11:54:52 +02:00
Fabian Homborg
0eeaa796fd docs: Fix argparse chapter
Missing a label.

Oops.

[ci skip]
2020-10-08 17:35:29 +02:00
Fabian Homborg
392b61014b docs: Some more argparse rewordings
[ci skip]
2020-10-07 21:52:35 +02:00
Fabian Homborg
194f4f3734 Update docs for multi-erase in abbr and set
[ci skip]
2020-10-04 12:39:32 +02:00
Ilan Cosman
067ec6ca97 Synopses examples for vcs services now function as intended 2020-10-02 23:45:38 +02:00
Fabian Homborg
17157b3516 docs: Update example prompt in fish_prompt docs
This used `whoami` and `hostname` and lacked spaces.

[ci skip]
2020-10-02 19:02:10 +02:00
Aurelio Jargas
8d2e4bbef5 Fix string match example
The `?` requires a char, so `foo` cannot match.
2020-09-28 18:49:55 +02:00
Johannes Altmanninger
286ad97cbd Improve string pad examples and add a cross-reference
The old examples were not really showcasing that it's nice for aligning text.
2020-09-28 18:42:02 +02:00
Fabian Homborg
d6d3abf59a Introduce $FISH_DEBUG and $FISH_DEBUG_OUTPUT variables
Same as the `--debug` and `--debug-output` options, can be enabled
when the option can't be passed, e.g. in linux shebangs.

Fixes #7359.
2020-09-28 17:46:37 +02:00
Johannes Altmanninger
f758d39535 string pad: handle padding characters of width > 1
If the padding is not divisible by the char's width without remainder,
we pad the remainder with spaces, so the total width of the output is correct.

Also add completions, changelog entry, adjust documentation, add examples
with emoji and some tests.  Apply some minor style nitpicks and avoid extra
allocations of the input strings.
2020-09-27 21:59:15 +02:00