Commit graph

132 commits

Author SHA1 Message Date
Fabian Boehm
b6bebec513 docs: Simplify Combining Lists section
This was a bit dense.
2024-05-15 20:18:17 +02:00
Fabian Boehm
20243132fb Add <? input redirection
This tries to open the given file to use as stdin, and if it fails,
for any reason, it uses /dev/null instead.

This is useful in cases where we would otherwise do either of these:

```fish
test -r /path/to/file
and string match foo < /path/to/file

cat /path/to/file 2>/dev/null | string match foo
```

This both makes it nicer and shorter, *and* helps with TOCTTOU - what if the file is removed/changed after the check?

The reason for reading /dev/null instead of a closed fd is that a closed fd will often cause an error.

In case opening /dev/null fails, it still skips the command.
That's really a last resort for when the operating system
has turned out to be a platypus and not a unix.

Fixes #4865

(cherry picked from commit df8b9b7095)
2024-04-21 14:35:13 +02:00
Fabian Boehm
2c17d34971
Deprecate builtin test's one- and zero-argument modes (#10365)
This introduces a feature flag, "test-require-arg", that removes builtin test's zero and one argument special modes.

That means:

- `test -n` returns false
- `test -z` returns true
- `test -x` with any other option errors out with "missing argument"
- `test foo` errors out as expecting an option

`test -n` returning true is a frequent source of confusion, and so we are breaking with posix in this regard.

As always the flag defaults to off and can be turned on. In future it will default to on and then eventually be made read-only.

There is a new FLOG category "deprecated-test", run `fish -d deprecated-test` and it will show any test call that would change in future.
2024-04-21 14:25:54 +02:00
Johannes Altmanninger
c921c124ef docs: use canonical key names in :kbd: tags
This seems a bit better because it's what bind uses.  To makes sure that
something like :kbd:`ctrl-x` looks good in HTML, remove the border from the
kbd style.  Else both "ctrl" and "x" get small boxes which looks weird.
2024-04-20 15:36:29 +02:00
Johannes Altmanninger
444cda20bc Document focus events 2024-04-06 18:14:17 +02:00
Fabian Boehm
1a4bb851ff docs: More on dereferencing variables 2024-04-05 18:41:09 +02:00
Fabian Boehm
f4a3dcca3a docs: Clarify command substitution section
Put `$()` version front-and-center and make the quoting more
prominent.

In turn mention `()` as a version that can't be quoted.
2024-04-01 15:40:25 +02:00
Fabian Boehm
8d71eef1da
Add feature flag to turn off %self (#10262)
This is the last remnant of the old percent expansion.

It has the downsides of it, in that it is annoying to combine with
anything:

```fish
echo %self/foo
```

prints "%self/foo", not fish's pid.

We have introduced $fish_pid in 3.0, which is much easier to use -
just like a variable, because it is one.

If you need backwards-compatibility for < 3.0, you can use the
following shim:

```fish
set -q fish_pid
or set -g fish_pid %self
```

So we introduce a feature-flag called "remove-percent-self" to turn it
off.

"%self" will simply not be special, e.g. `echo %self` will print
"%self".
2024-02-06 22:13:16 +01:00
Fabian Boehm
b8b062eb84 docs: Update qmark-noglob status
Note: The version number needs to be adjusted
2024-01-25 18:47:41 +01:00
Fabian Boehm
f4ba2866fc docs: Add overview table of "operators"
Fixes #10201
2024-01-14 11:06:37 +01:00
Fabian Boehm
f81c9cba50 docs: Make the vendor dirs a nested list 2023-11-07 17:55:36 +01:00
Fabian Boehm
ddd9d183e2 Document $__fish_vendor_confdirs and __fish_build_paths
Fixes #10078
2023-11-07 17:48:54 +01:00
Fabian Boehm
496fc03b98 docs: More on key timeout, key chord limitations 2023-10-24 18:25:49 +02:00
Fabian Boehm
778f4e6732 docs: Improve quoting variables section
This now specifically explains quoting with `set`, and the contrast to bash.
2023-09-11 17:31:00 +02:00
Fabian Boehm
d803ebbff9 docs: Some teensy bits on if/while
The ``test`` thing was just duplicated, and ``while`` linked to the
if-*command* page, where the syntax section is probably nicer
2023-08-26 09:32:05 +02:00
Fabian Boehm
53598d6a21 docs: More on if-conditions 2023-08-21 17:43:43 +02:00
Fabian Boehm
2f86b31bd3 docs: More on scopes
Let's start with an example to motivate the rest
2023-08-19 12:26:27 +02:00
Adam J. Stewart
72de1dc201 Docs: fix code block 2023-07-10 18:31:46 +02:00
Fabian Boehm
f980125fb9 docs: More on profiling 2023-06-16 16:22:58 +02:00
Jo
272d123431 Fix a typo in language.rst 2023-06-02 13:13:49 +02:00
Fabian Boehm
80324c9d7f docs: Fix link 2023-05-23 16:48:28 +02:00
Fabian Boehm
b435fc4539 docs: Add something on variables-as-commands
Specifically point towards the necessary splitting (as always,
separate ahead of time) and the keyword thing.

Fixes #9797
2023-05-21 10:13:54 +02:00
Fabian Boehm
9c5571f14f docs: Reword Combining lists section
This was quite hard to read, and the term "cartesian product" honestly
doesn't help
2023-05-12 18:53:53 +02:00
Fabian Boehm
d671710656 docs: Chapter on combining redirections
Fixes #5319
2023-04-01 16:03:24 +02:00
Fabian Boehm
9c8b50cb8f docs: Make some code lines shorter
For code, we need to limit the length because it can't be reflowed automatically
2023-02-15 18:50:28 +01:00
Fabian Boehm
811dbf0f9a docs: More on dereferencing variables
Also that unclosed quote was driving me up the wall
2023-02-15 18:29:14 +01:00
Fabian Boehm
d239e26f6b docs: Add a missing newline
Sphinx is annoyingly specific here
2023-01-29 14:46:35 +01:00
Eddie Lebow
1564c3e181 Minor formatting in Job Control documentation 2023-01-18 22:20:16 +01:00
Fabian Boehm
83d95cea35 docs: Reword quotes
Also explain that `$(foo)` is also done in double-quotes.
2023-01-18 16:39:37 +01:00
Fabian Boehm
d952ca1d1e docs: Rename "index range expansion" to "slices"
It's a simpler term.
2023-01-17 17:08:10 +01:00
Fabian Boehm
dda0c8178d docs: Remove "Variable scope for functions" chapter
This didn't need to be separately.

Also rename "More on universal variables" because it's the chapter on
universal variables.
2023-01-17 17:04:56 +01:00
Fabian Boehm
72a7111260 docs: Revise command substitution section 2023-01-16 18:36:59 +01:00
Fabian Boehm
97bef63af6 docs: Add more on conditionals 2023-01-16 17:53:08 +01:00
Fabian Boehm
a322e3f180 docs: Fix typo 2023-01-13 22:53:02 +01:00
shenleban tongying
27952db9f7 docs: clearify global vs universal variable 2023-01-13 15:58:37 +01:00
Fabian Boehm
51bce422fd docs: More about envvars 2023-01-09 20:33:37 +01:00
David Adam
c2ad9e44ec docs: include fish_cursor_selection_mode in list of special variables 2023-01-01 22:44:09 +08:00
Fabian Boehm
d14f39e583 docs/language: Some small bits 2022-12-30 13:52:55 +01:00
Fabian Boehm
3bacbeb2e1 docs/language: Improve argument parsing section
Better motivation and explanation.
2022-12-30 13:52:28 +01:00
Fabian Boehm
21c09c392b docs/language: Improve an example
If a code sample uses prompt-style (with `>` lines) it needs to do
that consistently, or the rest is taken as output and not highlighted.
2022-12-28 20:42:33 +01:00
Fabian Boehm
72ec20d3af docs: Some more in the intro sections 2022-12-27 15:22:17 +01:00
Fabian Boehm
a63c21a663 docs: Some more on tutorial and combiners 2022-12-27 14:17:27 +01:00
Fabian Boehm
dfaafd733a docs: Simplify exporting section 2022-12-21 16:24:00 +01:00
Fabian Boehm
d2cd6c1cd6 docs: Remove the term "wrapper"
This committed the sin of introducing a concept by giving it two
names:

> An alias, or wrapper, around ``ls`` might look like this

The term "wrapper" doesn't pull its weight here. It's simpler to just
call them aliases throughout. We do use "a simple wrapping function"
in another place, but that's to define "alias", not as a separate name.
2022-12-21 16:24:00 +01:00
Fabian Boehm
8284e0499f docs: Some work on redirections 2022-12-19 19:39:47 +01:00
Fabian Boehm
d640e0d0d6 docs/language: Some slight tweaks
It reads nicer to not have the "see also" thing right in the first
paragraph. I'm not even done reading this, why are you sending me
elsewhere?

(of course if it's a hotlink on a specific word that's different)
2022-12-07 21:47:00 +01:00
Fabian Boehm
e34f0e7c9f docs: Add some more envvars to reference
(and fix a couple of references)
2022-12-01 18:00:06 +01:00
Mahmoud Al-Qudsi
37b0f4dabc Document escape of new lines
I'm not sure if line continuations are covered anywhere else in the docs, but I
think the escapes section of the language page is a good place to mention them.
2022-11-09 13:01:09 -06:00
Mahmoud Al-Qudsi
e3c67ae229 Reword debugging section in language docs
- Clean up the wording a little.
- Highlight the limitations of the "debugger" more clearly and don't mislead
  people into thinking it's possible to really interactively set/remove
  breakpoints except in select circumstances.

Sidenote: I can't believe we're using a markup language that doesn't support
nested inline markup. What a crying shame, rST!
2022-10-23 12:51:12 -05:00
Fabian Boehm
23b5390a0c docs: Mention --profile 2022-10-23 13:43:02 +02:00