Make --install install without confirmation, and not exit

This commit is contained in:
Fabian Boehm 2024-12-13 18:30:18 +01:00
parent 6d28845c2b
commit be16eeef69
3 changed files with 5 additions and 19 deletions

View File

@ -173,7 +173,7 @@ You can also build fish as a self-installing binary.
This will include all the datafiles like the included functions or web configuration tool in the main ``fish`` binary. This will include all the datafiles like the included functions or web configuration tool in the main ``fish`` binary.
On the first interactive run, and whenever it notices they are out of date, it will extract the datafiles to ~/.local/share/fish/install/ (currently, subject to change). You can do this manually by running ``fish --install`` (or ``fish --install=noconfirm`` to skip the confirmation). On the first interactive run, and whenever it notices they are out of date, it will extract the datafiles to ~/.local/share/fish/install/ (currently, subject to change). You can do this manually by running ``fish --install``.
To install fish as self-installable, just use ``cargo``, like:: To install fish as self-installable, just use ``cargo``, like::

View File

@ -40,10 +40,9 @@ The following options are available:
**-i** or **--interactive** **-i** or **--interactive**
The shell is interactive. The shell is interactive.
**--install[=noconfirm]** **--install**
When built as self-installable (via cargo), this will unpack fish's datafiles and place them in ~/.local/share/fish/install/. 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 ask to do this automatically when run interactively.
Fish will also do this automatically when run interactively.
**-l** or **--login** **-l** or **--login**
Act as if invoked as a login shell. Act as if invoked as a login shell.

View File

@ -540,7 +540,7 @@ fn fish_parse_opt(args: &mut [WString], opts: &mut FishCmdOpts) -> ControlFlow<i
wopt(L!("no-config"), NoArgument, 'N'), wopt(L!("no-config"), NoArgument, 'N'),
wopt(L!("no-execute"), NoArgument, 'n'), wopt(L!("no-execute"), NoArgument, 'n'),
wopt(L!("print-rusage-self"), NoArgument, RUSAGE_ARG), wopt(L!("print-rusage-self"), NoArgument, RUSAGE_ARG),
wopt(L!("install"), OptionalArgument, 'I'), wopt(L!("install"), NoArgument, 'I'),
wopt( wopt(
L!("print-debug-categories"), L!("print-debug-categories"),
NoArgument, NoArgument,
@ -576,20 +576,7 @@ fn fish_parse_opt(args: &mut [WString], opts: &mut FishCmdOpts) -> ControlFlow<i
'h' => opts.batch_cmds.push("__fish_print_help fish".into()), 'h' => opts.batch_cmds.push("__fish_print_help fish".into()),
'i' => opts.is_interactive_session = true, 'i' => opts.is_interactive_session = true,
'I' => { 'I' => {
let noconfirm = match w.woptarg { install(false);
None => false,
Some(n) if n == L!("noconfirm") => true,
_ => {
FLOGF!(
error,
"Unknown argument to --install: '%ls'",
w.woptarg.unwrap()
);
std::process::exit(1);
}
};
let ret = install(!noconfirm);
std::process::exit(if ret { 0 } else { 1 });
} }
'l' => opts.is_login = true, 'l' => opts.is_login = true,
'N' => { 'N' => {