mirror of
https://github.com/fish-shell/fish-shell
synced 2025-01-13 21:44:16 +00:00
functions/__fish_npm_helper: Use python for json
[ci skip]
This commit is contained in:
parent
bf926fd6c4
commit
ba1249763b
1 changed files with 5 additions and 2 deletions
|
@ -12,7 +12,7 @@ function __yarn_helper_installed
|
|||
set -l old (commandline)
|
||||
commandline -r ""
|
||||
echo \nfish: Run `$argv[1] all-the-package-names` to gain intelligent \
|
||||
package completion > /dev/stderr
|
||||
package completion >&2
|
||||
commandline -f repaint
|
||||
commandline -r $old
|
||||
set -g __fish_yarn_pkg_info_shown 1
|
||||
|
@ -57,7 +57,10 @@ function __yarn_installed_packages
|
|||
return 1
|
||||
end
|
||||
|
||||
if type -q jq
|
||||
if set -l python (__fish_anypython)
|
||||
$python -c 'import json, sys; data = json.load(sys.stdin);
|
||||
print("\n".join(data["dependencies"])); print("\n".join(data["devDependencies"]))' < $package_json 2>/dev/null
|
||||
else if type -q jq
|
||||
jq -r '.dependencies as $a1 | .devDependencies as $a2 | ($a1 + $a2) | to_entries[] | .key' $package_json
|
||||
else
|
||||
set -l depsFound 0
|
||||
|
|
Loading…
Reference in a new issue