1
0
mirror of https://github.com/robbyrussell/oh-my-zsh.git synced 2025-12-14 03:10:40 +01:00
Files
oh-my-zsh/plugins/adwnode/_adwnode
2023-02-22 22:50:58 +01:00

17 lines
490 B
Plaintext

_load_nodejs_scripts() {
local read_package_json_scripts_command="try { Object.keys(require('./package.json').scripts).join('\n').replace(/:/g, '\\\:') } catch {''}"
nodejs_scripts=("${(@f)$(node -pe ${read_package_json_scripts_command} | sort)}")
}
_adwnode() {
if command -v node >/dev/null 2>&1; then
if [ -f ./package.json ]; then
_load_nodejs_scripts
if [[ ! ${#nodejs_scripts[@]} -eq 0 ]]; then
_describe '' nodejs_scripts
fi
fi
fi
}