@kaitranntt/ccs 7.65.3-dev.1 → 7.65.3-dev.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +36 -3
- package/dist/auth/auth-commands.d.ts +1 -0
- package/dist/auth/auth-commands.d.ts.map +1 -1
- package/dist/auth/auth-commands.js +11 -0
- package/dist/auth/auth-commands.js.map +1 -1
- package/dist/auth/commands/backup-command.d.ts +3 -0
- package/dist/auth/commands/backup-command.d.ts.map +1 -0
- package/dist/auth/commands/backup-command.js +126 -0
- package/dist/auth/commands/backup-command.js.map +1 -0
- package/dist/auth/commands/index.d.ts +1 -0
- package/dist/auth/commands/index.d.ts.map +1 -1
- package/dist/auth/commands/index.js +3 -1
- package/dist/auth/commands/index.js.map +1 -1
- package/dist/auth/profile-continuity-inheritance.d.ts +1 -0
- package/dist/auth/profile-continuity-inheritance.d.ts.map +1 -1
- package/dist/auth/profile-continuity-inheritance.js +10 -6
- package/dist/auth/profile-continuity-inheritance.js.map +1 -1
- package/dist/auth/profile-detector.d.ts +9 -1
- package/dist/auth/profile-detector.d.ts.map +1 -1
- package/dist/auth/profile-detector.js +35 -0
- package/dist/auth/profile-detector.js.map +1 -1
- package/dist/auth/resume-lane-diagnostics.d.ts +21 -0
- package/dist/auth/resume-lane-diagnostics.d.ts.map +1 -0
- package/dist/auth/resume-lane-diagnostics.js +146 -0
- package/dist/auth/resume-lane-diagnostics.js.map +1 -0
- package/dist/auth/resume-lane-warning.d.ts +9 -0
- package/dist/auth/resume-lane-warning.d.ts.map +1 -0
- package/dist/auth/resume-lane-warning.js +60 -0
- package/dist/auth/resume-lane-warning.js.map +1 -0
- package/dist/ccs.js +47 -4
- package/dist/ccs.js.map +1 -1
- package/dist/cliproxy/gemini-cli-quota-normalizer.d.ts +10 -0
- package/dist/cliproxy/gemini-cli-quota-normalizer.d.ts.map +1 -0
- package/dist/cliproxy/gemini-cli-quota-normalizer.js +122 -0
- package/dist/cliproxy/gemini-cli-quota-normalizer.js.map +1 -0
- package/dist/cliproxy/quota-fetcher-gemini-cli.d.ts.map +1 -1
- package/dist/cliproxy/quota-fetcher-gemini-cli.js +133 -92
- package/dist/cliproxy/quota-fetcher-gemini-cli.js.map +1 -1
- package/dist/cliproxy/quota-types.d.ts +8 -0
- package/dist/cliproxy/quota-types.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.d.ts.map +1 -1
- package/dist/commands/cliproxy/quota-subcommand.js +10 -1
- package/dist/commands/cliproxy/quota-subcommand.js.map +1 -1
- package/dist/commands/command-catalog.d.ts +39 -0
- package/dist/commands/command-catalog.d.ts.map +1 -0
- package/dist/commands/command-catalog.js +298 -0
- package/dist/commands/command-catalog.js.map +1 -0
- package/dist/commands/completion-backend.d.ts +14 -0
- package/dist/commands/completion-backend.d.ts.map +1 -0
- package/dist/commands/completion-backend.js +208 -0
- package/dist/commands/completion-backend.js.map +1 -0
- package/dist/commands/cursor-command-display.d.ts.map +1 -1
- package/dist/commands/cursor-command-display.js +25 -5
- package/dist/commands/cursor-command-display.js.map +1 -1
- package/dist/commands/cursor-command.d.ts +1 -3
- package/dist/commands/cursor-command.d.ts.map +1 -1
- package/dist/commands/cursor-command.js +3 -15
- package/dist/commands/cursor-command.js.map +1 -1
- package/dist/commands/help-command.d.ts +4 -3
- package/dist/commands/help-command.d.ts.map +1 -1
- package/dist/commands/help-command.js +155 -507
- package/dist/commands/help-command.js.map +1 -1
- package/dist/commands/root-command-router.d.ts +2 -0
- package/dist/commands/root-command-router.d.ts.map +1 -1
- package/dist/commands/root-command-router.js +13 -13
- package/dist/commands/root-command-router.js.map +1 -1
- package/dist/commands/shell-completion-command.d.ts +1 -0
- package/dist/commands/shell-completion-command.d.ts.map +1 -1
- package/dist/commands/shell-completion-command.js +27 -11
- package/dist/commands/shell-completion-command.js.map +1 -1
- package/dist/cursor/constants.d.ts +3 -0
- package/dist/cursor/constants.d.ts.map +1 -0
- package/dist/cursor/constants.js +20 -0
- package/dist/cursor/constants.js.map +1 -0
- package/dist/cursor/cursor-models.d.ts.map +1 -1
- package/dist/cursor/cursor-models.js +2 -0
- package/dist/cursor/cursor-models.js.map +1 -1
- package/dist/cursor/cursor-profile-executor.d.ts +10 -0
- package/dist/cursor/cursor-profile-executor.d.ts.map +1 -0
- package/dist/cursor/cursor-profile-executor.js +158 -0
- package/dist/cursor/cursor-profile-executor.js.map +1 -0
- package/dist/cursor/cursor-translator.d.ts +22 -11
- package/dist/cursor/cursor-translator.d.ts.map +1 -1
- package/dist/cursor/cursor-translator.js +254 -75
- package/dist/cursor/cursor-translator.js.map +1 -1
- package/dist/cursor/index.d.ts +1 -0
- package/dist/cursor/index.d.ts.map +1 -1
- package/dist/cursor/index.js +4 -1
- package/dist/cursor/index.js.map +1 -1
- package/dist/shared/claude-extension-setup.d.ts.map +1 -1
- package/dist/shared/claude-extension-setup.js +36 -16
- package/dist/shared/claude-extension-setup.js.map +1 -1
- package/dist/targets/target-runtime-compatibility.d.ts.map +1 -1
- package/dist/targets/target-runtime-compatibility.js +6 -0
- package/dist/targets/target-runtime-compatibility.js.map +1 -1
- package/dist/types/profile.d.ts +1 -1
- package/dist/types/profile.d.ts.map +1 -1
- package/dist/ui/assets/accounts-BjfPKR8m.js +1 -0
- package/dist/ui/assets/{alert-dialog-C5RdUHi9.js → alert-dialog-Dh2NUFdm.js} +1 -1
- package/dist/ui/assets/{api-C0ROFLme.js → api-C-3mQCFf.js} +1 -1
- package/dist/ui/assets/{auth-section-M2azTP3G.js → auth-section-Dp10_YyD.js} +1 -1
- package/dist/ui/assets/{backups-section-DIDUVa0t.js → backups-section-C0jF8MP1.js} +1 -1
- package/dist/ui/assets/{channels-D_5uerEp.js → channels-CkXuK5i7.js} +1 -1
- package/dist/ui/assets/{checkbox-CgMg7fDH.js → checkbox-tA5FH8Ol.js} +1 -1
- package/dist/ui/assets/{claude-extension-DA9wMzPz.js → claude-extension-Bg2ZkzMz.js} +1 -1
- package/dist/ui/assets/{cliproxy-4yUL1fQw.js → cliproxy-1qRVSbVC.js} +2 -2
- package/dist/ui/assets/{cliproxy-ai-providers-DedMcdcc.js → cliproxy-ai-providers-DBSXTTyw.js} +1 -1
- package/dist/ui/assets/cliproxy-control-panel-Da-sGGyI.js +1 -0
- package/dist/ui/assets/{codex-CAWw4ZNl.js → codex-ooWKOPa2.js} +1 -1
- package/dist/ui/assets/{confirm-dialog-Ds0PYz2R.js → confirm-dialog-CKjwhn9j.js} +1 -1
- package/dist/ui/assets/{copilot-m6i00mFy.js → copilot-GA7EPiK1.js} +1 -1
- package/dist/ui/assets/{cursor-COeD0Dgq.js → cursor-B6c8CyHG.js} +1 -1
- package/dist/ui/assets/{droid-CznUyiRx.js → droid-CPRHOIX2.js} +1 -1
- package/dist/ui/assets/{globalenv-section-FgK1eGWk.js → globalenv-section-Czgnw_GV.js} +1 -1
- package/dist/ui/assets/{health-Cpu6bD6K.js → health-CXLOMk8n.js} +1 -1
- package/dist/ui/assets/icons-B9oTjo-t.js +1 -0
- package/dist/ui/assets/index-BMHPMj0j.js +69 -0
- package/dist/ui/assets/{index-DgnxlKNk.js → index-BceMcbCR.js} +1 -1
- package/dist/ui/assets/{index-C7sG68Mi.js → index-Boa5e-GY.js} +1 -1
- package/dist/ui/assets/index-CknHGRYp.css +1 -0
- package/dist/ui/assets/{index-DampXntj.js → index-CvfzKRSH.js} +1 -1
- package/dist/ui/assets/{index-Bhz6T039.js → index-D2v_-6AW.js} +1 -1
- package/dist/ui/assets/{index-rTSyskt3.js → index-v-DY6Zby.js} +1 -1
- package/dist/ui/assets/{masked-input-B_l4FMkE.js → masked-input-B1_asiUI.js} +1 -1
- package/dist/ui/assets/{proxy-status-widget-C7wSbfPC.js → proxy-status-widget-Ci1JpStj.js} +1 -1
- package/dist/ui/assets/{radix-ui-C98W0NRG.js → radix-ui-Zb8sVEtn.js} +1 -1
- package/dist/ui/assets/{raw-json-settings-editor-panel-CViWFt6t.js → raw-json-settings-editor-panel-DMbTkxWw.js} +1 -1
- package/dist/ui/assets/{searchable-select-7-yJbbw2.js → searchable-select-HbP2PXl3.js} +1 -1
- package/dist/ui/assets/{separator-DApM4Wa5.js → separator-CdaalG0K.js} +1 -1
- package/dist/ui/assets/{shared-Blmm7sMd.js → shared-BiFB-et0.js} +1 -1
- package/dist/ui/assets/{table-BwM4zncv.js → table-BPwgFXLQ.js} +1 -1
- package/dist/ui/assets/{tanstack-CfKik0yL.js → tanstack-DWm6aJ-G.js} +1 -1
- package/dist/ui/assets/{updates-DJ0ofB67.js → updates-l8Co9uve.js} +1 -1
- package/dist/ui/index.html +5 -5
- package/dist/utils/config-manager.d.ts +5 -0
- package/dist/utils/config-manager.d.ts.map +1 -1
- package/dist/utils/config-manager.js +10 -1
- package/dist/utils/config-manager.js.map +1 -1
- package/dist/utils/hooks/image-analysis-backend-resolver.d.ts.map +1 -1
- package/dist/utils/hooks/image-analysis-backend-resolver.js +8 -0
- package/dist/utils/hooks/image-analysis-backend-resolver.js.map +1 -1
- package/dist/web-server/routes/account-routes.d.ts.map +1 -1
- package/dist/web-server/routes/account-routes.js +14 -2
- package/dist/web-server/routes/account-routes.js.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.d.ts.map +1 -1
- package/dist/web-server/routes/cliproxy-auth-routes.js +80 -6
- package/dist/web-server/routes/cliproxy-auth-routes.js.map +1 -1
- package/lib/hooks/websearch-transformer.cjs +37 -2
- package/package.json +1 -1
- package/scripts/completion/README.md +55 -131
- package/scripts/completion/ccs.bash +22 -190
- package/scripts/completion/ccs.fish +19 -245
- package/scripts/completion/ccs.ps1 +37 -427
- package/scripts/completion/ccs.zsh +27 -305
- package/dist/ui/assets/accounts-Dh95PibK.js +0 -1
- package/dist/ui/assets/cliproxy-control-panel-B0kwxgNi.js +0 -1
- package/dist/ui/assets/icons-CeH5899d.js +0 -1
- package/dist/ui/assets/index-B6SrL1O-.css +0 -1
- package/dist/ui/assets/index-CcKb4PL_.js +0 -69
|
@@ -1,446 +1,56 @@
|
|
|
1
1
|
# PowerShell completion for CCS (Claude Code Switch)
|
|
2
|
-
# Compatible with PowerShell 5.1+
|
|
3
|
-
#
|
|
4
|
-
# Installation:
|
|
5
|
-
# Add to your PowerShell profile ($PROFILE):
|
|
6
|
-
# . /path/to/ccs/scripts/completion/ccs.ps1
|
|
7
|
-
#
|
|
8
|
-
# Or install for current user:
|
|
9
|
-
# Copy-Item scripts/completion/ccs.ps1 ~\Documents\PowerShell\Scripts\
|
|
10
|
-
# Add to profile: . ~\Documents\PowerShell\Scripts\ccs.ps1
|
|
11
2
|
|
|
12
|
-
|
|
13
|
-
param(
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
$authCommands = @('create', 'list', 'show', 'remove', 'default', '--help', '-h')
|
|
18
|
-
$apiCommands = @('create', 'list', 'remove', '--help', '-h')
|
|
19
|
-
$cliproxyCommands = @('create', 'list', 'remove', '--install', '--latest', '--help', '-h')
|
|
20
|
-
$apiCreateFlags = @('--base-url', '--api-key', '--model', '--force', '--yes', '-y')
|
|
21
|
-
$cliproxyCreateFlags = @('--provider', '--model', '--force', '--yes', '-y')
|
|
22
|
-
$providerFlags = @('--auth', '--config', '--logout', '--headless', '--help', '-h')
|
|
23
|
-
$updateFlags = @('--force', '--beta', '--dev', '--help', '-h')
|
|
24
|
-
$envFlags = @('--format', '--shell', '--help', '-h')
|
|
25
|
-
$envFormats = @('openai', 'anthropic', 'raw')
|
|
26
|
-
$envShells = @('auto', 'bash', 'zsh', 'fish', 'powershell')
|
|
27
|
-
$shellCompletionFlags = @('--bash', '--zsh', '--fish', '--powershell')
|
|
28
|
-
$listFlags = @('--verbose', '--json')
|
|
29
|
-
$removeFlags = @('--yes', '-y')
|
|
30
|
-
$showFlags = @('--json')
|
|
31
|
-
$providers = @('gemini', 'codex', 'agy', 'qwen')
|
|
32
|
-
|
|
33
|
-
# Get current position in command
|
|
34
|
-
$words = $commandAst.ToString() -split '\s+' | Where-Object { $_ -ne '' }
|
|
35
|
-
$position = $words.Count
|
|
36
|
-
|
|
37
|
-
# Helper function to get profiles
|
|
38
|
-
function Get-CcsProfiles {
|
|
39
|
-
param([string]$Type = 'all')
|
|
40
|
-
|
|
41
|
-
$profiles = @()
|
|
42
|
-
|
|
43
|
-
# Settings-based profiles
|
|
44
|
-
if ($Type -in @('all', 'settings')) {
|
|
45
|
-
$configPath = "$env:USERPROFILE\.ccs\config.json"
|
|
46
|
-
if (Test-Path $configPath) {
|
|
47
|
-
try {
|
|
48
|
-
$config = Get-Content $configPath -Raw | ConvertFrom-Json
|
|
49
|
-
$profiles += $config.profiles.PSObject.Properties.Name
|
|
50
|
-
} catch {}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
# Account-based profiles
|
|
55
|
-
if ($Type -in @('all', 'account')) {
|
|
56
|
-
$profilesPath = "$env:USERPROFILE\.ccs\profiles.json"
|
|
57
|
-
if (Test-Path $profilesPath) {
|
|
58
|
-
try {
|
|
59
|
-
$data = Get-Content $profilesPath -Raw | ConvertFrom-Json
|
|
60
|
-
$profiles += $data.profiles.PSObject.Properties.Name
|
|
61
|
-
} catch {}
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
# CLIProxy variants
|
|
66
|
-
if ($Type -in @('all', 'cliproxy')) {
|
|
67
|
-
$configPath = "$env:USERPROFILE\.ccs\config.json"
|
|
68
|
-
if (Test-Path $configPath) {
|
|
69
|
-
try {
|
|
70
|
-
$config = Get-Content $configPath -Raw | ConvertFrom-Json
|
|
71
|
-
if ($config.cliproxy) {
|
|
72
|
-
$profiles += $config.cliproxy.PSObject.Properties.Name
|
|
73
|
-
}
|
|
74
|
-
} catch {}
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
return $profiles | Sort-Object -Unique
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
# Top-level completion
|
|
82
|
-
if ($position -eq 2) {
|
|
83
|
-
$allOptions = $commands + $cliproxyProfiles + (Get-CcsProfiles)
|
|
84
|
-
$allOptions | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
85
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
86
|
-
$_,
|
|
87
|
-
$_,
|
|
88
|
-
'ParameterValue',
|
|
89
|
-
$_
|
|
90
|
-
)
|
|
91
|
-
}
|
|
92
|
-
return
|
|
93
|
-
}
|
|
3
|
+
function Invoke-CcsCompletionBackend {
|
|
4
|
+
param(
|
|
5
|
+
[string]$CurrentWord,
|
|
6
|
+
[string[]]$TokensBeforeCurrent
|
|
7
|
+
)
|
|
94
8
|
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
100
|
-
$_,
|
|
101
|
-
$_,
|
|
102
|
-
'ParameterValue',
|
|
103
|
-
$_
|
|
104
|
-
)
|
|
105
|
-
}
|
|
106
|
-
}
|
|
107
|
-
return
|
|
9
|
+
$repoRoot = (Resolve-Path (Join-Path $PSScriptRoot '..\..')).Path
|
|
10
|
+
$repoCli = Join-Path $repoRoot 'dist\ccs.js'
|
|
11
|
+
if (-not (Test-Path $repoCli)) {
|
|
12
|
+
$repoCli = Join-Path $repoRoot 'bin\ccs.js'
|
|
108
13
|
}
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
if ($words[1] -in $cliproxyProfiles) {
|
|
112
|
-
$providerFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
113
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
114
|
-
$_,
|
|
115
|
-
$_,
|
|
116
|
-
'ParameterValue',
|
|
117
|
-
$_
|
|
118
|
-
)
|
|
119
|
-
}
|
|
14
|
+
if (Test-Path $repoCli) {
|
|
15
|
+
& node $repoCli __complete --shell powershell --current $CurrentWord -- @TokensBeforeCurrent 2>$null
|
|
120
16
|
return
|
|
121
17
|
}
|
|
122
18
|
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
$updateFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
126
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
127
|
-
$_,
|
|
128
|
-
$_,
|
|
129
|
-
'ParameterValue',
|
|
130
|
-
$_
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
return
|
|
19
|
+
if (Get-Command ccs -ErrorAction SilentlyContinue) {
|
|
20
|
+
& ccs __complete --shell powershell --current $CurrentWord -- @TokensBeforeCurrent 2>$null
|
|
134
21
|
}
|
|
22
|
+
}
|
|
135
23
|
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
if ($position -eq 3) {
|
|
139
|
-
$options = $cliproxyProfiles + (Get-CcsProfiles -Type settings) + $envFlags
|
|
140
|
-
$options | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
141
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
142
|
-
$_,
|
|
143
|
-
$_,
|
|
144
|
-
'ParameterValue',
|
|
145
|
-
$_
|
|
146
|
-
)
|
|
147
|
-
}
|
|
148
|
-
} elseif ($position -ge 4) {
|
|
149
|
-
switch ($words[$position - 2]) {
|
|
150
|
-
'--format' {
|
|
151
|
-
$envFormats | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
152
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
153
|
-
$_,
|
|
154
|
-
$_,
|
|
155
|
-
'ParameterValue',
|
|
156
|
-
$_
|
|
157
|
-
)
|
|
158
|
-
}
|
|
159
|
-
}
|
|
160
|
-
'--shell' {
|
|
161
|
-
$envShells | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
162
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
163
|
-
$_,
|
|
164
|
-
$_,
|
|
165
|
-
'ParameterValue',
|
|
166
|
-
$_
|
|
167
|
-
)
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
default {
|
|
171
|
-
$envFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
172
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
173
|
-
$_,
|
|
174
|
-
$_,
|
|
175
|
-
'ParameterValue',
|
|
176
|
-
$_
|
|
177
|
-
)
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
return
|
|
183
|
-
}
|
|
24
|
+
Register-ArgumentCompleter -CommandName ccs -ScriptBlock {
|
|
25
|
+
param($commandName, $wordToComplete, $commandAst, $fakeBoundParameters)
|
|
184
26
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
)
|
|
195
|
-
}
|
|
196
|
-
} elseif ($position -eq 4) {
|
|
197
|
-
switch ($words[2]) {
|
|
198
|
-
'show' {
|
|
199
|
-
$options = (Get-CcsProfiles -Type account) + $showFlags
|
|
200
|
-
$options | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
201
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
202
|
-
$_,
|
|
203
|
-
$_,
|
|
204
|
-
'ParameterValue',
|
|
205
|
-
$_
|
|
206
|
-
)
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
'remove' {
|
|
210
|
-
$options = (Get-CcsProfiles -Type account) + $removeFlags
|
|
211
|
-
$options | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
212
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
213
|
-
$_,
|
|
214
|
-
$_,
|
|
215
|
-
'ParameterValue',
|
|
216
|
-
$_
|
|
217
|
-
)
|
|
218
|
-
}
|
|
219
|
-
}
|
|
220
|
-
'default' {
|
|
221
|
-
Get-CcsProfiles -Type account | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
222
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
223
|
-
$_,
|
|
224
|
-
$_,
|
|
225
|
-
'ParameterValue',
|
|
226
|
-
$_
|
|
227
|
-
)
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
'list' {
|
|
231
|
-
$listFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
232
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
233
|
-
$_,
|
|
234
|
-
$_,
|
|
235
|
-
'ParameterValue',
|
|
236
|
-
$_
|
|
237
|
-
)
|
|
238
|
-
}
|
|
239
|
-
}
|
|
240
|
-
'create' {
|
|
241
|
-
@('--force') | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
242
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
243
|
-
$_,
|
|
244
|
-
$_,
|
|
245
|
-
'ParameterValue',
|
|
246
|
-
$_
|
|
247
|
-
)
|
|
248
|
-
}
|
|
249
|
-
}
|
|
250
|
-
}
|
|
251
|
-
} elseif ($position -eq 5) {
|
|
252
|
-
switch ($words[2]) {
|
|
253
|
-
'show' {
|
|
254
|
-
$showFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
255
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
256
|
-
$_,
|
|
257
|
-
$_,
|
|
258
|
-
'ParameterValue',
|
|
259
|
-
$_
|
|
260
|
-
)
|
|
261
|
-
}
|
|
262
|
-
}
|
|
263
|
-
'remove' {
|
|
264
|
-
$removeFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
265
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
266
|
-
$_,
|
|
267
|
-
$_,
|
|
268
|
-
'ParameterValue',
|
|
269
|
-
$_
|
|
270
|
-
)
|
|
271
|
-
}
|
|
272
|
-
}
|
|
27
|
+
$commandElements = @($commandAst.CommandElements | ForEach-Object { $_.Extent.Text })
|
|
28
|
+
$tokensBeforeCurrent = @()
|
|
29
|
+
if ($commandElements.Count -gt 1) {
|
|
30
|
+
$tokensBeforeCurrent = $commandElements[1..($commandElements.Count - 1)]
|
|
31
|
+
if ($tokensBeforeCurrent.Count -gt 0 -and $tokensBeforeCurrent[-1] -eq $wordToComplete) {
|
|
32
|
+
$tokensBeforeCurrent = if ($tokensBeforeCurrent.Count -gt 1) {
|
|
33
|
+
$tokensBeforeCurrent[0..($tokensBeforeCurrent.Count - 2)]
|
|
34
|
+
} else {
|
|
35
|
+
@()
|
|
273
36
|
}
|
|
274
37
|
}
|
|
275
|
-
return
|
|
276
38
|
}
|
|
277
39
|
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
$apiCommands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
282
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
283
|
-
$_,
|
|
284
|
-
$_,
|
|
285
|
-
'ParameterValue',
|
|
286
|
-
$_
|
|
287
|
-
)
|
|
288
|
-
}
|
|
289
|
-
} elseif ($position -eq 4) {
|
|
290
|
-
switch ($words[2]) {
|
|
291
|
-
'remove' {
|
|
292
|
-
$options = (Get-CcsProfiles -Type settings) + $removeFlags
|
|
293
|
-
$options | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
294
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
295
|
-
$_,
|
|
296
|
-
$_,
|
|
297
|
-
'ParameterValue',
|
|
298
|
-
$_
|
|
299
|
-
)
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
'create' {
|
|
303
|
-
$apiCreateFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
304
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
305
|
-
$_,
|
|
306
|
-
$_,
|
|
307
|
-
'ParameterValue',
|
|
308
|
-
$_
|
|
309
|
-
)
|
|
310
|
-
}
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
} elseif ($position -eq 5) {
|
|
314
|
-
switch ($words[2]) {
|
|
315
|
-
'remove' {
|
|
316
|
-
$removeFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
317
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
318
|
-
$_,
|
|
319
|
-
$_,
|
|
320
|
-
'ParameterValue',
|
|
321
|
-
$_
|
|
322
|
-
)
|
|
323
|
-
}
|
|
324
|
-
}
|
|
325
|
-
}
|
|
40
|
+
foreach ($line in Invoke-CcsCompletionBackend -CurrentWord $wordToComplete -TokensBeforeCurrent $tokensBeforeCurrent) {
|
|
41
|
+
if ([string]::IsNullOrWhiteSpace($line)) {
|
|
42
|
+
continue
|
|
326
43
|
}
|
|
327
|
-
return
|
|
328
|
-
}
|
|
329
44
|
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
if ($
|
|
333
|
-
$cliproxyCommands | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
334
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
335
|
-
$_,
|
|
336
|
-
$_,
|
|
337
|
-
'ParameterValue',
|
|
338
|
-
$_
|
|
339
|
-
)
|
|
340
|
-
}
|
|
341
|
-
} elseif ($position -eq 4) {
|
|
342
|
-
switch ($words[2]) {
|
|
343
|
-
'remove' {
|
|
344
|
-
$options = (Get-CcsProfiles -Type cliproxy) + $removeFlags
|
|
345
|
-
$options | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
346
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
347
|
-
$_,
|
|
348
|
-
$_,
|
|
349
|
-
'ParameterValue',
|
|
350
|
-
$_
|
|
351
|
-
)
|
|
352
|
-
}
|
|
353
|
-
}
|
|
354
|
-
'create' {
|
|
355
|
-
$cliproxyCreateFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
356
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
357
|
-
$_,
|
|
358
|
-
$_,
|
|
359
|
-
'ParameterValue',
|
|
360
|
-
$_
|
|
361
|
-
)
|
|
362
|
-
}
|
|
363
|
-
}
|
|
364
|
-
}
|
|
365
|
-
} elseif ($position -eq 5) {
|
|
366
|
-
switch ($words[2]) {
|
|
367
|
-
'remove' {
|
|
368
|
-
$removeFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
369
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
370
|
-
$_,
|
|
371
|
-
$_,
|
|
372
|
-
'ParameterValue',
|
|
373
|
-
$_
|
|
374
|
-
)
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
'create' {
|
|
378
|
-
# After --provider, complete with provider names
|
|
379
|
-
if ($words[3] -eq '--provider') {
|
|
380
|
-
$providers | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
381
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
382
|
-
$_,
|
|
383
|
-
$_,
|
|
384
|
-
'ParameterValue',
|
|
385
|
-
$_
|
|
386
|
-
)
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
}
|
|
392
|
-
return
|
|
393
|
-
}
|
|
45
|
+
$parts = $line -split "`t", 2
|
|
46
|
+
$value = $parts[0]
|
|
47
|
+
$description = if ($parts.Count -gt 1) { $parts[1] } else { $parts[0] }
|
|
394
48
|
|
|
395
|
-
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
$_,
|
|
402
|
-
'ParameterValue',
|
|
403
|
-
$_
|
|
404
|
-
)
|
|
405
|
-
}
|
|
406
|
-
} elseif ($position -eq 4) {
|
|
407
|
-
switch ($words[2]) {
|
|
408
|
-
'remove' {
|
|
409
|
-
$options = (Get-CcsProfiles -Type settings) + $removeFlags
|
|
410
|
-
$options | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
411
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
412
|
-
$_,
|
|
413
|
-
$_,
|
|
414
|
-
'ParameterValue',
|
|
415
|
-
$_
|
|
416
|
-
)
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
'create' {
|
|
420
|
-
$apiCreateFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
421
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
422
|
-
$_,
|
|
423
|
-
$_,
|
|
424
|
-
'ParameterValue',
|
|
425
|
-
$_
|
|
426
|
-
)
|
|
427
|
-
}
|
|
428
|
-
}
|
|
429
|
-
}
|
|
430
|
-
} elseif ($position -eq 5) {
|
|
431
|
-
switch ($words[2]) {
|
|
432
|
-
'remove' {
|
|
433
|
-
$removeFlags | Where-Object { $_ -like "$wordToComplete*" } | ForEach-Object {
|
|
434
|
-
[System.Management.Automation.CompletionResult]::new(
|
|
435
|
-
$_,
|
|
436
|
-
$_,
|
|
437
|
-
'ParameterValue',
|
|
438
|
-
$_
|
|
439
|
-
)
|
|
440
|
-
}
|
|
441
|
-
}
|
|
442
|
-
}
|
|
443
|
-
}
|
|
444
|
-
return
|
|
49
|
+
[System.Management.Automation.CompletionResult]::new(
|
|
50
|
+
$value,
|
|
51
|
+
$value,
|
|
52
|
+
'ParameterValue',
|
|
53
|
+
$description
|
|
54
|
+
)
|
|
445
55
|
}
|
|
446
56
|
}
|