Make fish installable

When built with the default "installable" feature, the data files (share/) are
included in the fish binary itself.

Run `fish --install` or `fish --install=noconfirm` (for
non-interactive use) to install fish's data files into ~/.local/share/fish/install

To figure out if the data files are out of date, we write the current version
to a file on install, and read it on start.

CMake disables the default features so nothing changes for that, but this allows installing via `cargo install`,
and even making a static binary that you can then just upload and have extract itself.

We set $__fish_help_dir to empty for installable builds, because we do not have
a way to generate html docs (because we need fish_indent for highlighting).
The man pages are found via $__fish_data_dir/man
This commit is contained in:
Fabian Boehm
2024-01-31 15:50:13 +01:00
parent 7827a8e533
commit 7c73c5fec0
7 changed files with 425 additions and 33 deletions

View File

@@ -181,7 +181,7 @@ function help --description 'Show help for the fish shell'
set -l version_string (string split . -f 1,2 -- $version | string join .)
set -l ext_url https://fishshell.com/docs/$version_string/$fish_help_page
set -l page_url
if test -f $__fish_help_dir/index.html; and not set -lq chromeos_linux_garcon
if set -q __fish_help_dir[1]; and test -f $__fish_help_dir/index.html; and not set -lq chromeos_linux_garcon
# Help is installed, use it
set page_url file://$__fish_help_dir/$fish_help_page