Setting a non-existant path component to PATH logs an error to stderr.
This is not appropriate for non-interactive temporary modifications,
like the one done by the `sudo` completion helper function.
The new --wraps functionality was breaking aliases of the form
`alias foo='bar baz'`. That is, aliases where the body is multiple
words. Extract the first word of the body and use that instead.
Use better errors for aliases with no name or no body.
Add the --wraps option to 'complete' and 'function'. This allows a
command to (recursively) inherit the completions of a wrapped command.
Fixes#393.
When evaluating a completion, we inspect the entire "wrap chain" for a
command, i.e. we follow the sequence of wrapping until we either hit a
loop (which we silently ignore) or the end of the chain. We then
evaluate completions as if the wrapping command were substituted with
the wrapped command. Currently this only works for commands, i.e.
'complete --command gco --wraps git\ checkout' won't work (that would
seem to encroaching on abbreviations anyways). It might be useful to
show an error message for that case.
The commandline builtin reflects the commandline with the wrapped
command substituted in, so e.g. git completions (which inspect the
command line) will just work. This sort of command line munging is
also performed by 'complete -C' so it's not totally without precedent.
'alias will also now mark its generated function as wrapping the
'target.
Currently fish doesn't recognize toor as special. However, it's likely
that on BSD systems, fish shell will be used on toor, not on root (toor
is an intentionally existing account to use more advanced shell on, like
shell).
Use `functions -q` instead of searching the `functiosn -na` list for the
provided word. This may result in an automatically-loaded function being
sourced, but that happens anyway with the default output.
This change means the results of `test -q foo` can be relied upon to
indicate whether `foo` can actually be invoked. Previosly, if `foo` was
the name of an automatically-loaded function file but did not actually
define a function `foo`, and there was no execuable `foo`, then `type -q
foo` would lie and say `foo` can be invoked when it can't.
The --quiet flag is useful when only the exit status matters.
Fix the documentation for the -t flag to no longer claim that `type` can
print "keyword", as it never does that.
Stop printing a blank line for functions/builtins when the -p flag has
been passed. It's just not useful.
Track whether -a and -f have been supplied separately. That way both
`type -a -f command` and `type -f -a command` behaves correctly, as does
`type -a -f foo` where there are multiple executables named `foo` in the
$PATH.
Stop using getopt to parse flags. It's far more expensive than
necessary, and results in long flags not being parsed on OS X. This also
allows args starting with - after the options list to be properly
interpreted as a value to test.
Print the error message to stderr as is appropriate.
Use the new `command -p` functionality when the -a flag has not been
provided (`command` does not have any equivalent to the -a flag),
instead of using `which`. This is faster and also avoids any possible
disagreement between `which` and what fish thinks is valid.
Stop testing every path to see if it's executable, that test has already
been done by `which` or `command -p`.
The end result is `type -P ls` is roughly 250% faster, according to
profiling, on my OS X machine.
* use $XDG_CACHE_HOME for __fish_print_packages completion caches
* when starting fishd, redirect fishd output to /dev/null, not a
predictable path
Fix for CVE-2014-3219.
Closes#1440.
Fix for CVE-2014-2906.
Closes a race condition in funced which would allow execution of
arbitrary code; closes a race condition in psub which would allow
alternation of the data stream.
Note that `psub -f` does not work (#1040); a fix should be committed
separately for ease of maintenance.
Closes#1437
At some point the non-verbose, non-informative variant of the prompt
(e.g. the variant that looks like the bash prompt) was modified to try
and show the behind/ahead counts the same way the informative prompt
does. Besides being wrong, it also didn't work because behind/ahead
weren't defined.
Previously, fish's command_not_found handler would be installed in
__fish_config_interactive. Errors that occured early in startup (e.g. in
config.fish) or in non-interactive mode would therefore not be reported.
With this change, fish now exposes its default cnf handler as
__fish_default_command_not_found_handler . config.fish then installs a
cnfh that invokes the default. When fish goes interactive, the initial
cnfh is overwritten with a fancier one, that may in turn fall back to
invoking the default.
commit d81ae2665f
Author: Max Gonzih <gonzih@gmail.com>
Date: Sun Feb 2 16:22:18 2014 +0300
Check for command-not-found command on suse
commit 004b794c82
Author: Max Gonzih <gonzih@gmail.com>
Date: Sun Feb 2 14:04:41 2014 +0300
Fix cnf handler for Suse and Fedora
fixes#1208
Presently, `isatty` only works on a handful of keywords. Here it
is rewritten to be able to take any path, device or fd number as
an argument, and eliminates errors printed to stdout.
Per discussion in #1228, using `builtin test -c` within a pipe to
test special file descriptors is not viable, so this implementation
specifcially uses `command test`. Additionally, a note has been
added to the documentation of `test` regarding this potential
aberration from the expected output of the test utility under the
'Standards' section.
Comment out 'o' binding
Add '['/']' bindings to navigate current token history
Fix 'P' to paste indeed
Add "*P/"*p to insert current selection clipboard using xsel
These options will be passed to the bind command.
Now it's possible to call
fish_default_key_bindings -M insert
to set all original bindings to the insert mode
The following normal mode bindings are added:
o, I, A, gg, G, g^, g$, x, X, backspace, d*, D, s, S, c*, C, ~, gu,
gU, J, K, y*, Y, p, P
I was not able to add binding for 'O'
dd now deletes the whole line as vim, while D deletes the line to the
end. c, s, y act the same way
Continuation of https://github.com/fish-shell/fish-shell/pull/1195/.
Removes use of --delimiter and --fields with cut(1) as these are GNU
extensions.
Note that a number of completions use these options, but as they are
only for GNU/Linux-specific tools have remained unmodified.
There is no need to explicitly check for two arguments and set --bold.
Instead the user can simply "set __fish_git_prompt_color_flags --bold
red".
The current check violates the expectation set by the documentation
that you can use any set_color argument as the current code interprets
"--bold red" as "--bold --bold" instead.
Plus, by passing the full contents of the variable directly, the user
can do more adventurous things like set the background as well.
git.git's git-prompt may not contain a configurable prefix, but it
does display a space before the upstream information when displaying
verbose information. Rather than using a space always or never,
default to a space whenever verbose is in showupstream.
Adds a "name" option to __fish_git_prompt_showupstream that shows an
abbreviated branch name when the upstream type is verbose.
Based on git.git 1f6806c: git-prompt.sh: optionally show upstream
branch name
Closes#479 by piping STDERR to /dev/null.
Also does much less manipulation of the package list; there are no
packages in any of the archives containing the names that are stripped
out as far as I can see.
It's rather hacky, but it sort of works. (but then, this makes fish
compare to PHP (but PHP doesn't put that newline), so perhaps I
shouldn't do that - http://git.io/GFurbg)
I break compatibility with Mac OS X again, that I don't have access
to. Result: Stuff break, and I have to fix it, so it will perhaps
work. At least, I hope it will work.
Yes, hostname is broken under Cygwin, but for fish it's an issue, as it
makes fish_config more buggy than it needs to be (by making UTF-8 errors
according to Python).
git.git's __git_ps1 doesn't have an upstream prefix. I'm not sure why
one was added to our __fish_git_prompt, but it certainly shouldn't
default to a space.
It reuses $__fish_git_prompt_char_stateseparator, since it has a
similar meaning and goes otherwise unused when
$__fish_git_prompt_show_informative_status is set.
This changes the defaults for several characters when
$__fish_git_prompt_show_informative_status is set so that the prompt
looks more like the typical informative prompt.
Before: (master >1<2|+3#4*5%6)
After: (master↑1↓2|●3✖4✚5…6)
The defaults were taken from magicmonty/bash-git-prompt
This makes $__fish_git_prompt_show_informative_status imply
$__fish_git_prompt_showupstream = "informative", while adding a none
option for showupstream to disable it if desired.