@glidea/codex-switch 0.2.0 → 0.2.1
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/bin/codex-switch.mjs +8 -7
- package/package.json +1 -1
package/bin/codex-switch.mjs
CHANGED
|
@@ -221,6 +221,7 @@ _codex_switch() {
|
|
|
221
221
|
commands=(
|
|
222
222
|
'add:add profile'
|
|
223
223
|
'edit:edit profile'
|
|
224
|
+
'rm:remove profile'
|
|
224
225
|
'list:list profiles'
|
|
225
226
|
'current:show current profile'
|
|
226
227
|
'completion:print shell completion script'
|
|
@@ -232,7 +233,7 @@ _codex_switch() {
|
|
|
232
233
|
fi
|
|
233
234
|
|
|
234
235
|
case "$words[2]" in
|
|
235
|
-
add|edit)
|
|
236
|
+
add|edit|rm)
|
|
236
237
|
if (( CURRENT == 3 )); then
|
|
237
238
|
_codex_switch_profiles
|
|
238
239
|
fi
|
|
@@ -262,7 +263,7 @@ _codex_switch() {
|
|
|
262
263
|
COMPREPLY=()
|
|
263
264
|
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
264
265
|
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
265
|
-
local commands="add edit list current completion"
|
|
266
|
+
local commands="add edit rm list current completion"
|
|
266
267
|
|
|
267
268
|
if [[ \${COMP_CWORD} -eq 1 ]]; then
|
|
268
269
|
local profiles
|
|
@@ -276,7 +277,7 @@ _codex_switch() {
|
|
|
276
277
|
return 0
|
|
277
278
|
fi
|
|
278
279
|
|
|
279
|
-
if [[ "\${COMP_WORDS[1]}" == "add" || "\${COMP_WORDS[1]}" == "edit" ]]; then
|
|
280
|
+
if [[ "\${COMP_WORDS[1]}" == "add" || "\${COMP_WORDS[1]}" == "edit" || "\${COMP_WORDS[1]}" == "rm" ]]; then
|
|
280
281
|
local profiles
|
|
281
282
|
profiles="$(_codex_switch_profiles)"
|
|
282
283
|
COMPREPLY=( $(compgen -W "\${profiles}" -- "\${cur}") )
|
|
@@ -294,8 +295,8 @@ function fishCompletionScript() {
|
|
|
294
295
|
end
|
|
295
296
|
|
|
296
297
|
complete -c codex-switch -f
|
|
297
|
-
complete -c codex-switch -n '__fish_use_subcommand' -a 'add edit list current completion (__codex_switch_profiles)'
|
|
298
|
-
complete -c codex-switch -n '__fish_seen_subcommand_from add edit' -a '(__codex_switch_profiles)'
|
|
298
|
+
complete -c codex-switch -n '__fish_use_subcommand' -a 'add edit rm list current completion (__codex_switch_profiles)'
|
|
299
|
+
complete -c codex-switch -n '__fish_seen_subcommand_from add edit rm' -a '(__codex_switch_profiles)'
|
|
299
300
|
complete -c codex-switch -n '__fish_seen_subcommand_from completion' -a 'zsh bash fish powershell'
|
|
300
301
|
`
|
|
301
302
|
}
|
|
@@ -304,7 +305,7 @@ function powershellCompletionScript() {
|
|
|
304
305
|
return `Register-ArgumentCompleter -Native -CommandName codex-switch -ScriptBlock {
|
|
305
306
|
param($wordToComplete, $commandAst, $cursorPosition)
|
|
306
307
|
$words = $commandAst.CommandElements | ForEach-Object { $_.Extent.Text }
|
|
307
|
-
$commands = @('add', 'edit', 'list', 'current', 'completion')
|
|
308
|
+
$commands = @('add', 'edit', 'rm', 'list', 'current', 'completion')
|
|
308
309
|
$profiles = @(codex-switch list 2>$null)
|
|
309
310
|
$candidates = @()
|
|
310
311
|
|
|
@@ -312,7 +313,7 @@ function powershellCompletionScript() {
|
|
|
312
313
|
$candidates = $commands + $profiles
|
|
313
314
|
} elseif ($words[1] -eq 'completion') {
|
|
314
315
|
$candidates = @('zsh', 'bash', 'fish', 'powershell')
|
|
315
|
-
} elseif ($words[1] -eq 'add' -or $words[1] -eq 'edit') {
|
|
316
|
+
} elseif ($words[1] -eq 'add' -or $words[1] -eq 'edit' -or $words[1] -eq 'rm') {
|
|
316
317
|
$candidates = $profiles
|
|
317
318
|
}
|
|
318
319
|
|