Using bare vars is more efficient because it makes the builtin `math`
expression cache more useful. That's because if you prefix each var with
a dollar-sign then the fish parser expands it before `math` is run.
Something like `math x + 1` can be cached since the expression is the
same each time it is run. But if you do `math $x + 1` and x==1 then you're
effectively executing `math 1 + 1`. And if x==2 the next time then you're
running `math 2 + 1`. Which makes the expression cache much less effective.
Remove our `math` function that wraps `bc`. Our math builtin is now good
enough that it can be the default implementation.
Another step in resolving #3157.
Per the discussion with @faho in #4332, replaced some custom completion
state detection functions with standard __fish_* functions used in other
completion sources.
(cherry picked from commit f706081ea4)
No longer auto-generated. Everything has been summarized. Supressing
file completions for initial command, providing list of valid initial
commands, filtering --options by subcommand.
(cherry picked from commit 539acd9fc5)
This patch adds completion for the update subcommand, that is, when the
user types in `composer update <tab>`.
The code depends on python for the json parsing. I'm not sure if this
is appropriate or if there is a fish-native way to parse json data.
Use suggestions for remove subcommand.
Add suggestions for why, why-not and depends.
Add why/why-not suggestion.
Specifically closes#4313.
Not being as agressive in what we ignore/blacklist, but can be revisited
easily in the future to add more characters to the argument blacklist.
Rewrite the `abbr` function to store each abbreviation in a separate
variable. This greatly improves the efficiency. For the common case
it is 5x faster. For pathological cases it is upwards of 100x faster.
Most people should be able to unconditionally define abbreviations in
their config.fish without a noticable slow down.
Fixes#4048
The primary motivation for --keep-order for `complete` was to support
something like commit history completions, which are returned by git in
reverse chronological order and make no sense alphabetically (they are
SHA1 hashes).
See https://github.com/fish-shell/fish-shell/issues/361 for more info.
* Make npm run-script completion faster with `jq`
When jq is available, it's actually faster to invoke jq and parse the `package.json`
invoking the `npm` command.
Also, prior to this commit, both `__fish_complete_npm` and `__fish_npm_run` were being run
whenever completions for `npm run` subcommand was being used, which was actually making
repetitive work (invoking npm command twice). This pull request is supposed to make completion
without `jq` faster as well
* Refactor npm.fish for code reutilization
Created function to handle both cases of npm run completion parse, with or without `jq` completion.
* Remove unecessary blank line
The recent change to switch `psub` to use `argparse` caused it to use
a fifo by default because it inadvertently fixed a long standing bug in
the fish script. This changes the behavior back to `psub --file` being
the default behavior and introduces a `--fifo` flag. It also updates the
documentation to make it clearer when and why `--fifo` mode should not
be used.
Fixes#4222
While updating the `history` function to use `argparse` I realized it is
useful to define an option that can be used in three ways. First by
using the short flag; e.g., `-n NNN`. Second by using the long flag;
e.g., `--max NNN`. Third, as an implicit int flag; e.g., `-NNN`. This
use case is now supported by a spec of the form `n#max`.
A recent regression to the `alias` command points out the need for more
unit tests of its behavior. I also decided to use it as an opportunity
to normalize the output of just `alias` to list aliases.
The previous change to use `argparse` for parity with every other
builtin and function introduced a regression. Invocations that start
with a negative number can fail because the negative value looks like an
invalid flag.
This implements a `fish_opt` command that provides a way for people
to create option specs for the `argparse` command as an alternative to
creating such strings by hand.
Fixes#4190
Var `___git_ps_color_suffix_done` is supposed to be
`___fish_git_prompt_color_suffix_done`. This bug was found by an
experimental change to detect the use of undefined variables (#4163).
Similarly, we should simply test whether `__fish_git_prompt_showcolorhints`
is set rather than set to a non-empty string.
We now have a builtin that can do URL escaping so use it. I can't find
any uses of our private `__fish_urlencode` function in any Oh-My-Fish or
Fisherman code so remove it.
This is another step to resolving issue #1310. It makes
`fish_breakpoint_prompt` a replacement for `fish_prompt` if it is defined
and we're presenting a prompt in the context of a `breakpoint` command.
This implements `status is-breakpoint` that returns true if the current
shell prompt is displayed in the context of a `breakpoint` command.
This also fixes several bugs. Most notably making `breakpoint` a no-op if
the shell isn't interactive. Also, typing `breakpoint` at an interactive
prompt should be an error rather than creating a new nested debugging
context.
Partial fix for #1310
* Added Magento2 CLI completions
This is the completion file for the Magento2 CLI application I use on my servers. It has an additional feature tho, I'm not sure if it fits into the fish completion philosophy:
If you provide limited access credentials, it will connect to the MySQL database and provide additional suggestions, such as available users, themes or indexers in the database. If this file is never touched, those suggestions simply won't show up. I, personally, find them to be pretty useful, though.
Should I remove those database suggestions before creating a PR?
* Removed functions using MySQL, updated formatting
* Several smaller fixes
* Improved descriptions
Tried to shorten the text as much as possible and removed unnecessary characters
* Implement https://github.com/hanny24/gradle-fish/blob/master/gradle.load
* Use XDG_CACHE_HOME
* Use __funced_md5
* Fix fish_md5.fish
* Actually use the new function.
* Use string match for matching tasks
* I goofed. Actually pass a string to complete -a
* Fix attempt to remove needed function...
* Fix regex
* Fix fish_md5.fish to use a flag
Per my comment in issue #3980 this implements `__fish_print_users` in
terms of `__fish_complete_users` so we don't have to modify both when a
change to how users are enumerated is needed.
This has the side benefit of working around a wild bug with readline+fish that I've reported to the upstream readline developers. (The result of that bug is that the hg processes are constantly being leaked as `bg` jobs in the shell, which is how I came to notice this in the first place)
This removes a need for packagers to either patch our shebangs or pick
a particular python.
This was already done in __fish_config_interactive (where we need to
duplicate the code because it involves backgrounding).
Work towards #3970.
Fedora puts them in /usr/lib64 without having /usr/lib as a symlink.
Also silence errors (in case a directory doesn't exist) and stringify.
See https://bugzilla.redhat.com/show_bug.cgi?id=1442628.
CC @amluto.
Fixes invalid character in variable name $fish_cursor_replace-one (used by fish_vi_cursor[_handle]) by renaming bind mode 'replace-one' to 'replace_one'.
* Basic Terraform completion supporting all commands
* Option completion for Terraform commands
* Search command line in reverse order
* CHANGELOG entry
* Fix `terraform untaint` completion
* Use common completion functions to handle subcommands
* Use imperative form and remove CHANGELOG changes
* Check whether tmp file was modified in `funced`
* More idiomatic error messages
* Store the checksum in a local variable
* MD5 function supporting both GNU and BSD
* Use `else if` in MD5 function
* Use `string` builtin instead of `cut`
Reviewing a PR for a completion script caused me to look at the
implementation for the `__fish_complete_directories` function. Which in
turn lead me to create this change to improve its implementation and add
unit tests for the function.
This is to make pasting literals easier.
When a user pastes something, we normally take it as-is.
The exception is when a single-quote is open, e.g. the current token
is
foo'bar
When something is pasted here, we escape single-quotes (`'`) and
backslashes (`\\`), so typing a `'` after it will turn it into a
literal token.
Fixes#967.
This is a terminal feature where pastes will be "bracketed" in
\e\[200~ and \e\[201~.
It is more of a "security" measure (since particularly copying from a
browser can copy text different from what the user sees, which might
be malicious) than a performance optimization.
Work towards #967.