This had this weird "pass along the sha, then check" logic to it which
is entirely unnecessary.
This function just says when something is staged, nothing more. Why
that is you can figure out for yourself.
This makes it easier to call this function, and it no longer prints an
empty line if nothing is staged.
This wasn't added to the prompt status order, so it was computed and
then not used for the informative prompt.
We still check later if we should compute it, so this is harmless if
showstashstate is unset.
Fixes#7136.
On my system this printed just "Description:" without any additional
characters, so this awkward `sed` didn't match and produced *all
packages on one line*.
Tbh this should probably be rewritten, but first we'd have to find a
way to get proper output here.
* docs/faq: Mention prepend_sudo
[ci skip]
* __fish_prepend_sudo: Use $history[1] if commandline is empty
Currently, if you press alt+s with an empty commandline, it inserts
"sudo", which seems fairly useless.
Now, it inserts "sudo " followed by the last history entry, which
makes it a replacement for `sudo !!`.
* docs
This reverts commit 1b0ec21773.
"Interactive" has multiple meanings here, one of them being "the whole shell" is interactive, which `status is-interactive` tests, and one "this interaction is interactive", which happens when `read`ing in a script.
Fixes#7080.
* Add an "_" builtin to call into gettext
We already have gettext in C++ (if available), so it seems weird to
fork off a command to start it from script.
This is only for fish's own translations. There's no way to call into
other catalogs, it just translates all arguments separately.
This is faster by a factor of ~1000, which allows us to call
translations much more, especially from scripts.
E.g. making fish_greeting global by default would hurt cost-wise,
given that my fish starts up in 8ms and just calling the current `_`
function takes 2ms, and that would have two calls.
Incidentally, this also makes us rely on a weirdly defined function
less, so it:
Fixes#6804.
* docs: Add `_` docs
Let's see if that filename works out.
* Reword _ docs
This is a function you can either execute once, interactively, or
stick in config.fish, and it will do the right thing.
Some options are included to choose some slightly different behavior,
like setting $PATH directly instead of $fish_user_paths, or moving
already existing components to the front/back instead of ignoring
them, or appending new components instead of prepending them.
The defaults were chosen because they are the most safe, and
especially because they allow it to be idempotent - running it again
and again and again won't change anything, it won't even run the
actual `set` because it skips that if all components are already in.
Fixes#6960.
fish_git_prompt encloses its output in brackets, however this can be changed by supplying a format string to it, i.e. `fish_git_prompt %s`.
However when using `fish_vcs_prompt` there's no way to pass on the arg to fish_git_prompt, so you need to manually remove it.
fish_hg_prompt doesn't have the same format string support as fish_git_prompt, but I suppose it could be added later if needed.
We don't need to call it if a job was stopped, because in that case
read_i() will fire fish_prompt already, because the newly stopped job
was probably a foreground job.
Fixes#1018
The default implementation will not print any output in that case, but this provides users with additional flexibility when it comes to customising the shell's behaviour.
This allows users to customise the behaviour of the shell by redefining the function. This is similar to how fish_title or fish_greeting behave, where the default implementation can be easily overridden.
The function receives as arguments the job id, command line, signal name and signal description.
At the moment calling __fish_prepend_sudo multiple times does not toggle
sudo, and also unnecessarily uses the `-c` flag to `commandline` to see if
the first token on the commandline is "sudo".
This change removes the `-c` switch and also toggles "sudo" on multiple
calls to __fish_prepend_sudo, while maintaining the cursor position and
while maintaining any spaces between "sudo" and the next token on the
commandline.
The completions for help know many more help topics, it makes no sense
to whitelist them here.
Fix anchor links for tutorial sections.
Remove some dead code: the "man" branch was unreachable because of the
earlier (__fish_print_commands) case.
It removed $KONSOLE_PROFILE_NAME and added $KONSOLE_VERSION.
Let's assume if $KONSOLE_PROFILE_NAME is set we use the old sequences,
if not we use the new ones.
This reverts commit 535845861a.
That commit introduced a bug where tab-completing commands no longer
prints their descriptions, unless there is an exact match.