1
Fork 0
mirror of https://github.com/RGBCube/nu_scripts synced 2025-08-01 14:47:47 +00:00

Added completions for npm (#187)

* added npm

* added npm

Co-authored-by: Yethal <nosuchemail@email.com>
This commit is contained in:
Yethal 2022-03-23 22:30:35 +01:00 committed by GitHub
parent 9e868131b9
commit fd7c123ed1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 32 additions and 0 deletions

View file

@ -0,0 +1,5 @@
# NPM Custom Completions
### Definition
These scripts should be used to demonstrate how create custom completions for npm.

View file

@ -0,0 +1,27 @@
export extern "npm" [
command: string@"nu-complete npm"
]
def "nu-complete npm" [] {
^npm -l
|lines
|find 'Run "'
|str trim
|split column -c ' '
|get column4
|str find-replace '"' ''
}
def "nu-complete npm run" [] {
open ./package.json
|get scripts
|columns
}
export extern "npm run" [
command: string@"nu-complete npm run"
--workspace(-w)
--include-workspace-root
--if-present
--ignore-scripts
--script-shell
]