Commit Graph

14 Commits

Author SHA1 Message Date
ridiculousfish
a5fd0b317e Revert "Switch to bare vars in our math invocations"
This reverts commit bd18736ee5.

Bare variables should only be used in commands that must
manipulate the variable stack, such as `set`.
2017-09-09 23:35:47 -07:00
Kurtis Rader
bd18736ee5 Switch to bare vars in our math invocations
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.
2017-08-24 12:38:10 -07:00
Thales Mello
a071deaf61 Make npm run-script completion faster with jq (#4241)
* 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
2017-07-26 13:31:35 +02:00
Fabian Homborg
0a8c922d92 Use command -sq instead of redirection
This option has been available for a while now and it's a bit shorter.
2017-02-18 22:16:55 +01:00
Fabian Homborg
10661bb024 npm completions: Check command npm existence
Really fixes #3158 and #3152.
2016-06-21 17:42:22 +02:00
Fabian Homborg
3a0d417b9e npm completions: Call command npm
npm is often wrapped by a function.

Fixes #3158.
2016-06-21 12:03:29 +02:00
Aaron Gyes
36691df6fe Stringify many completions and functions, with --invert stringification.
I believe apm must have been buggy - example output that I found online
showed `tr` was mangling paths with spaces in it. Should be fixed.

Also, use dscl on OS X in __fish_complete_users.fish like
__fish_print_users.fish already does.
2016-04-08 10:49:29 +08:00
Stefan Maric
527c932e93 Fix npm run completion executing only on completions load, also:
* Better handling of `npm run` output
2015-09-12 12:12:21 +02:00
Stefan Maric
cba3db6205 Remove redundant completions that lack descriptions for npm 2015-09-12 12:12:21 +02:00
Stefan Maric
3b798b1733 Make use of npm completion 2015-09-12 12:12:21 +02:00
Stefan Maric
f898d82536 Add script values as descriptions to npm run/run-script completion 2015-09-12 12:12:21 +02:00
Stefan Maric
3b5aab6edb Complete list of available scripts for npm run/run-script command 2015-09-12 12:12:21 +02:00
Fabian Homborg
5e555fc1cf Completions: Don't check $cmd[1]
This is already done by fish before calling the completion.

It breaks completion with combiners (#2025) and also with wrappers.

(This does not include git because that's better solved in #2145)
2015-08-17 12:29:03 +02:00
phette23
5591afff6e add completions for Node.js & NPM 2014-07-29 18:35:08 -07:00