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:
parent
9e868131b9
commit
fd7c123ed1
2 changed files with 32 additions and 0 deletions
5
custom-completions/npm/README.md
Normal file
5
custom-completions/npm/README.md
Normal file
|
@ -0,0 +1,5 @@
|
|||
# NPM Custom Completions
|
||||
|
||||
### Definition
|
||||
|
||||
These scripts should be used to demonstrate how create custom completions for npm.
|
27
custom-completions/npm/npm-completions.nu
Normal file
27
custom-completions/npm/npm-completions.nu
Normal 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
|
||||
]
|
Loading…
Add table
Add a link
Reference in a new issue