Skip to content

Commit 99fcf09

Browse files
committed
🎉 Init
1 parent 2436975 commit 99fcf09

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed

src/commands.ps1

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
$cmds = @(
2+
'access',
3+
'adduser',
4+
'bin',
5+
'bugs',
6+
'build',
7+
'bundle',
8+
'cache',
9+
'ci',
10+
'completion',
11+
'config',
12+
'dedupe',
13+
'deprecate',
14+
'dist-tag',
15+
'docs',
16+
'doctor',
17+
'edit',
18+
'explore',
19+
'help',
20+
'help-search',
21+
'init',
22+
'install',
23+
'install-test',
24+
'link',
25+
'logout',
26+
'ls',
27+
'npm',
28+
'outdated',
29+
'owner',
30+
'pack',
31+
'ping',
32+
'prefix',
33+
'profile',
34+
'prune',
35+
'publish',
36+
'rebuild',
37+
'repo',
38+
'restart',
39+
'root',
40+
'run-script',
41+
'search',
42+
'shrinkwrap',
43+
'star',
44+
'stars',
45+
'start',
46+
'stop',
47+
'team',
48+
'test',
49+
'token',
50+
'uninstall',
51+
'unpublish',
52+
'update',
53+
'version',
54+
'view',
55+
'whoami'
56+
)

src/completions.ps1

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
@('npm', 'npm.cmd') | ForEach-Object {
2+
Register-ArgumentCompleter -Native -CommandName $_ -ScriptBlock {
3+
param($wordToComplete, $commandAst, $cursorPosition)
4+
5+
. (Join-Path $PSScriptRoot .\commands.ps1)
6+
$cmds |
7+
Where-Object { $_ -like "$wordToComplete*" } |
8+
Sort-Object |
9+
ForEach-Object {
10+
[System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_)
11+
}
12+
}
13+
}

0 commit comments

Comments
 (0)