Commit graph

1627 commits

Author SHA1 Message Date
ridiculousfish
53a2484fd1 Warn the user when visiting old documentation
This enhances our documentation to look for the file
/release_version.json in the root of our site. If found, and if it
contains a RELEASE_VERSION other than this version, then unhide a banner
warning about the stale documentation and linking to the current.
2022-06-20 17:56:14 -07:00
Fabian Boehm
1819c7f2b8 docs: Add more specific guidance on locale variables 2022-06-17 22:08:00 +02:00
Fabian Boehm
4f0c0486a6 Fix copy-pasteo in fish_config docs 2022-06-17 09:23:38 +02:00
Fabian Boehm
88b445ce9e Put short footnotes on one line again
Unlike before, this doesn't force the number to be on the same line as
strongly, that's fine.

So short footnotes look like

-------------
[1] Some text
-------------

Longer footnotes may look like

--------------
[2]

Some more text
--------------
2022-06-16 19:14:45 +02:00
Fabian Boehm
70a1febd6d Readd some missed changes
The "Warning:" on the warning (in index.html#default shell) wasn't in
the line with the text, the features list had more padding and some
headers were smaller, some table stuff
2022-06-16 19:14:45 +02:00
Fabian Boehm
e5a1da8b22 Remove unneeded guff 2022-06-16 19:14:45 +02:00
Fabian Boehm
6d8b88fb1d doc theme: Simplify
Move related stuff together and remove some unneeded guff

Specifically the weird "clear:" stuff causes rendering issues for me
in Firefox.
2022-06-16 19:14:45 +02:00
Fabian Homborg
618b0d0add Make doc css not depend on sphinx' css
This has required workarounds a few times, plus if it changes it might
break our theme. See e.g.

4712da3eb1
e27456df24
a6d484836e
85522036f5

So we import the rules we *use* and throw away the rest. Note that
this might still have rules that are no longer necessary - e.g. some
that are required to work around sphinx bugs would still be left.

It could benefit from some cleanup and simplification, and from
switching to a flex layout instead of the 230px hardcoded
sidebar - sphinx tried that, but it doesn't really work with our
narrow layout, so we disabled it again.
2022-06-16 19:14:45 +02:00
Fabian Boehm
8f08fe80fd Restyle codebase
Not a lot of changes, tbh
2022-06-16 18:43:28 +02:00
Fabian Boehm
18433278ec Document that status fish-path is platform-specific 2022-06-16 16:39:09 +02:00
David Adam
0431f21bb2 docs: list reserved keywords 2022-06-16 19:45:55 +10:00
Fabian Homborg
3552a11afa fish_git_prompt: Print cleanstate character whenever it's defined
And then only define it in informative mode.
2022-06-08 21:23:43 +02:00
Fabian Homborg
ca9910edb7 fish_git_prompt: Add colors for dirty/staged branches
This is a neat feature of the terlar git prompt
2022-06-08 21:23:43 +02:00
Fabian Homborg
f9a170e5f2 git_prompt: Only show untracked files in informative mode if asked
This makes it so

1. The informative status can work without showing untracked
files (previously it was disabled if bash.showUntrackedFiles was
false)
2. If untrackedfiles isn't explicitly enabled, we use -uno, so git
doesn't have to scan all the files.

In a large repository (like the FreeBSD ports repo), this can improve
performance by a factor of 5 or up.
2022-06-07 13:30:03 +02:00
Fabian Homborg
78ffb50d1f docs: Fix typo 2022-06-07 13:28:11 +02:00
SeekingBlues
cf620c829b Improve newline behavior of kill-whole-line
Previously, `kill-whole-line` kills the line and its following
newline. This is insufficient when we are on the last line, because
it would not actually clear the line. The cursor would stay on the
line, which is not the correct behavior for bindings like `dd`.

Also, `cc` in vi-mode used `kill-whole-line`, which is not correct
because it should not remove any newlines. We have to introduce
another special input function (`kill-inner-line`) to fix this.
2022-06-04 13:45:25 -07:00
Fabian Homborg
82445e3e6d docs: Add colored border to inline code
Makes it stand out just a teensy bit more. It's the same border we use
for code *blocks*
2022-06-01 20:58:27 +02:00
Fabian Homborg
f5848135e3 docs: Yeah nah undo flex
This is broken in narrow screens - the sidebar shrinks to unusable
proportions but still stays.

So instead we go the *other* way, force the left margin and undo the flexifying.

(again we should really stop relying on sphinx' css)
2022-06-01 20:54:02 +02:00
Fabian Homborg
b487f8b662 docs: Darker border color for dark mode code blocks 2022-06-01 20:44:53 +02:00
Fabian Homborg
4712da3eb1 docs theme: Make work with sphinx 4.5 and 5.0
Sphinx 5.0 makes the document div a flex container, which clashes
badly with the margin that earlier versions need.

So we remove the margin and flex the div ourselves, which should work
with either.

It's time we make this freestanding - these changes are annoying.
2022-06-01 17:48:51 +02:00
Fabian Homborg
10fb5f2d37 fish_for_bash_users: Some more on variables 2022-06-01 17:35:55 +02:00
Fabian Homborg
6d93f89e03 docs theme: Make inline code stand out more 2022-06-01 17:35:42 +02:00
Fabian Homborg
64b34c8cda Allow complete to have multiple conditions
This makes it so `complete -c foo -n test1 -n test2` registers *both*
conditions, and when it comes time to check the candidate, tries both,
in that order. If any fails it stops, if all succeed the completion is offered.

The reason for this is that it helps with caching - we have a
condition cache, but conditions like

```fish
test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length

test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] sub
```

defeats it pretty easily, because the cache only looks at the entire
script as a string - it can't tell that the first `test` is the same
in both.

So this means we separate it into

```fish
complete -f -c string -n "test (count (commandline -opc)) -ge 2; and contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
+complete -f -c string -n "test (count (commandline -opc)) -ge 2" -n "contains -- (commandline -opc)[2] length" -s V -l visible -d "Use the visible width, excluding escape sequences"
```

which allows the `test` to be cached.

In tests, this improves performance for the string completions by 30%
by reducing all the redundant `test` calls.

The `git` completions can also greatly benefit from this.
2022-05-30 20:47:14 +02:00
Fabian Boehm
4612343d6e
Merge pull request #8958 from faho/builtin-path
This adds a path builtin to deal with paths.

It offers the following subcommands:

    filter to go through a list of paths and only print the ones that pass some filter - exist, are a directory, have read permission, ...
    is as a shortcut for filter -q to only return true if one of the paths passed the filter
    basename, dirname and extension to print certain parts of the path
    change-extension to change the extension to a different one (as a string operation)
    normalize and resolve to canonicalize the paths in various flavors
    sort to sort paths, also only using the basename or dirname as a key

The definition of "extension" here was carefully considered and should line up with how extensions are actually used - ~/.bashrc doesn't have an extension, but ~/.conf.d does (".d").

These subcommands all compose well - they can read from arguments or stdin (like string), they can use null-delimited input or output (input is autodetected - if a NULL happens in the first PATH_MAX bytes it switches automatically).

It is both a failglob exception (so like set if a glob passed to it fails it just doesn't get any arguments for it instead of triggering an error), and passes output to command substitution buffers explicitly split (like string split0) so newlines are easy to handle.
2022-05-29 20:15:03 +02:00
Fabian Homborg
67b0860fe7 Rename sort --invert to sort --reverse/-r
To match sort(1).
2022-05-29 17:53:03 +02:00
Fabian Homborg
c87d063211 Update docs 2022-05-29 17:48:40 +02:00
Fabian Homborg
00949fccda Rename --what to --key
More sorty, less generic.
2022-05-29 17:48:40 +02:00
Fabian Homborg
e87ad48f9b Test and document symlink loop 2022-05-29 17:48:40 +02:00
Fabian Homborg
b6ebf15c75 Refer to asci 0x00 as "NUL"
it is the american standard code for information, after all
2022-05-29 17:48:40 +02:00
Fabian Homborg
e5858522e3 Document ./- more. 2022-05-29 17:48:12 +02:00
Fabian Homborg
bc3d3de30a Also prepend "./" for filter if a filename starts with "-"
This is now added to the two commands that definitely deal with
relative paths.

It doesn't work for e.g. `path basename`, because after removing the
dirname prepending a "./" doesn't refer to the same file, and the
basename is also expected to not contain any slashes.
2022-05-29 17:48:12 +02:00
Fabian Homborg
c88f648cdf Add sort --unique 2022-05-29 17:48:12 +02:00
Fabian Homborg
54778f65f8 Some sort docs 2022-05-29 17:48:12 +02:00
Fabian Homborg
b961afed49 normalize: Add "./" if a path starts with a "-" 2022-05-29 17:48:11 +02:00
Fabian Homborg
bb3700997c Correct docs for normalize/resolve
Resolve absolutizes, normalize doesn't
2022-05-29 17:48:11 +02:00
Fabian Homborg
83a993a28e Remove references to match/expand in the docs 2022-05-29 17:48:11 +02:00
Fabian Homborg
2b8bb5bd7f path: Rename "real" to "resolve" 2022-05-29 17:48:11 +02:00
Fabian Homborg
5844164feb document real change 2022-05-29 17:48:11 +02:00
Fabian Homborg
4fced3ef5a Remove sticky filter
This isn't super useful, and having a caveat in the docs that it might
cause the entire filter to fail is awkward.

So just remove it.
2022-05-29 17:48:11 +02:00
Fabian Homborg
972ed61266 path: Docs work 2022-05-29 17:48:11 +02:00
Fabian Homborg
1c1e643218 WIP path: Make extensions start at the "."
This includes the "." in what `path extension` prints.

This allows distinguishing between an empty extension (just `.`) and a
non-existent extension (no `.` at all).
2022-05-29 17:48:11 +02:00
Fabian Homborg
37fd508a59 Path is also a failglob exception 2022-05-29 17:48:11 +02:00
Fabian Homborg
d991096cb4 Add some more links in the docs 2022-05-29 17:48:11 +02:00
Fabian Homborg
ce7281905d Switch strip-extension to change-extension
This allows replacing the extension, e.g.

    > path change-extension mp4 foo.wmv
    foo.mp4
2022-05-29 17:48:11 +02:00
Fabian Homborg
00ed0bfb5d Rename base/dir to basename/dirname
"dir" sounds like it asks "is it a directory".
2022-05-29 17:48:11 +02:00
Fabian Homborg
fbfad686aa Another pass over the docs 2022-05-29 17:48:11 +02:00
Fabian Homborg
9f174d3a62 Moar on the docs 2022-05-29 17:48:11 +02:00
Fabian Homborg
d0e8eb1700 docs: Replace the general options recantation with "GENERAL_OPTIONS"
I'm not sure if this is the actual proper syntax to describe this, but
it sure is a heck of a lot more readable.
2022-05-29 17:48:11 +02:00
Fabian Homborg
efb3ae6d49 Add path is shorthand for path filter -q
This replaces `test -e` and such.
2022-05-29 17:48:11 +02:00
Fabian Homborg
b23548b2a6 Add "-rwx" and "-fdl" shorthand
These are short flags for "--perm=read" and "--type=link" and such.

Not every type or permission has a shorthand - we don't want "-s" for
"suid". So just the big three each get one.
2022-05-29 17:48:11 +02:00