mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-05-20 10:31:16 -03:00
Historically, `fish -C "commandline echo"` was silently ignored. Make it do the expected thing. This won't affect subsequent readers because we only do it for top-level ones, and reader_pop() will clear the commandline state again. This improves consistency with the parent commit. We probably don't want to support arbitrary readline commands before the first reader is initialized, but setting the initial commandline seems useful: first, it would have helped me in the past for debugging fish. Second, it would allow one to rewrite an application launcher: foot --app-id my-foot-launcher -e fish -C ' set fish_history launcher bind escape exit bind ctrl-\[ exit - function fish_should_add_to_history - false - end - for enter in enter ctrl-j - bind $enter '\'' - history append -- "$(commandline)" - commandline "setsid $(commandline) </dev/null >/dev/null 2>&1 & disown && exit" - commandline -f execute - '\'' - end + commandline "setsid </dev/null >/dev/null 2>&1 & disown && exit" + commandline --cursor $(string length "setsid ") ' which is probably not desirable today because it will disable autosuggestions. Though that could be fixed eventually by making autosuggestions smarter. If we find a generally-useful use case, we should mention this in the changelog. Ref: https://github.com/fish-shell/fish-shell/pull/11570#discussion_r2144544053