Automatically attempt to install

This is fairly subtle.

When installable, and we either can't find the version file or it is
outdated, we ask the user to confirm installation (just like `--install`).

We do that only if we are really truly interactive (with a tty!) to
avoid `fish -c` running into problems.
This check could be tightened even more, because currently:

```fish
fish -ic 'echo foo'
```

asks, while

```fish
fish -ic 'echo foo' < /dev/null
```

does not.

`fish -c` will still error out if it can't find the config, but it
will just run if it is out of date.
This commit is contained in:
Fabian Boehm
2024-12-10 18:49:34 +01:00
parent 99fa8aaaa7
commit 6d28845c2b
4 changed files with 60 additions and 54 deletions

View File

@@ -43,6 +43,7 @@ The following options are available:
**--install[=noconfirm]**
When built as self-installable (via cargo), this will unpack fish's datafiles and place them in ~/.local/share/fish/install/.
Using ``--install=noconfirm`` will skip the confirmation step.
Fish will also do this automatically when run interactively.
**-l** or **--login**
Act as if invoked as a login shell.