mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2025-12-12 01:52:31 +01:00
feat(adwnode): add plugin
This commit is contained in:
parent
aca048814b
commit
dc019bc3ec
4 changed files with 55 additions and 0 deletions
17
plugins/adwnode/_adwnode
Normal file
17
plugins/adwnode/_adwnode
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
_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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue