mirror of
https://github.com/fish-shell/fish-shell.git
synced 2024-11-22 10:06:49 +08:00
Speed up python startup time
This commit is contained in:
parent
82ab7e39f0
commit
45b1ca25a5
|
@ -52,7 +52,7 @@ function __bower_list_installed
|
|||
|
||||
if set -l python (__fish_anypython)
|
||||
# Warning: That weird indentation is necessary, because python.
|
||||
$python -c 'import json, sys; data = json.load(sys.stdin);
|
||||
$python -S -c 'import json, sys; data = json.load(sys.stdin);
|
||||
for k,v in data["dependencies"].items(): print(k + "\t" + v[:18])' bower.json 2>/dev/null
|
||||
return
|
||||
end
|
||||
|
|
|
@ -31,7 +31,7 @@ data = json.load(json_data)
|
|||
json_data.close()
|
||||
packages = itertools.chain(data['require'].keys(), data['require-dev'].keys())
|
||||
print(\"\n\".join(packages))
|
||||
" | $python
|
||||
" | $python -S
|
||||
end
|
||||
|
||||
function __fish_composer_installed_packages
|
||||
|
@ -48,7 +48,7 @@ for package in data['packages']:
|
|||
for package in data['packages-dev']:
|
||||
installed_packages.append(package['name'])
|
||||
print(\"\n\".join(installed_packages))
|
||||
" | $python
|
||||
" | $python -S
|
||||
end
|
||||
|
||||
function __fish_composer_scripts
|
||||
|
@ -61,7 +61,7 @@ data = json.load(json_data)
|
|||
json_data.close()
|
||||
if 'scripts' in data and data['scripts']:
|
||||
print(\"\n\".join(data['scripts'].keys()))
|
||||
" | $python
|
||||
" | $python -S
|
||||
end
|
||||
|
||||
# add cmds list
|
||||
|
|
|
@ -91,7 +91,7 @@ function __fish_npm_run
|
|||
# npm is dog-slow and might check for updates online!
|
||||
if test -e package.json; and set -l python (__fish_anypython)
|
||||
# Warning: That weird indentation is necessary, because python.
|
||||
$python -c 'import json, sys; data = json.load(sys.stdin);
|
||||
$python -S -c 'import json, sys; data = json.load(sys.stdin);
|
||||
for k,v in data["scripts"].items(): print(k + "\t" + v[:18])' <package.json 2>/dev/null
|
||||
else if command -sq jq; and test -e package.json
|
||||
jq -r '.scripts | to_entries | map("\(.key)\t\(.value | tostring | .[0:20])") | .[]' package.json
|
||||
|
|
|
@ -73,7 +73,7 @@ complete -f -c yarn -n '__fish_use_subcommand' -a run
|
|||
function __fish_yarn_run
|
||||
if test -e package.json; and set -l python (__fish_anypython)
|
||||
# Warning: That weird indentation is necessary, because python.
|
||||
$python -c 'import json, sys; data = json.load(sys.stdin);
|
||||
$python -S -c 'import json, sys; data = json.load(sys.stdin);
|
||||
for k,v in data["scripts"].items(): print(k + "\t" + v[:18])' <package.json 2>/dev/null
|
||||
else if test -e package.json; and type -q jq
|
||||
jq -r '.scripts | to_entries | map("\(.key)\t\(.value | tostring | .[0:20])") | .[]' package.json
|
||||
|
|
|
@ -58,7 +58,7 @@ function __yarn_installed_packages
|
|||
end
|
||||
|
||||
if set -l python (__fish_anypython)
|
||||
$python -c 'import json, sys; data = json.load(sys.stdin);
|
||||
$python -S -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
|
||||
|
|
Loading…
Reference in New Issue
Block a user