Add strict custom field registry
This commit is contained in:
@@ -9,6 +9,7 @@ $script:GspSubcommands = @(
|
||||
'completion',
|
||||
'validate',
|
||||
'index',
|
||||
'fields',
|
||||
'trace',
|
||||
'flatten',
|
||||
'pack',
|
||||
@@ -27,6 +28,7 @@ $script:GspFlags = @{
|
||||
'completion' = @('powershell', 'bash', 'zsh', 'fish', 'install')
|
||||
'validate' = @('--root', '--out')
|
||||
'index' = @('--root', '--out')
|
||||
'fields' = @('list', 'validate')
|
||||
'trace' = @('--root', '--depth', '--out')
|
||||
'flatten' = @('--root', '--depth', '--include-type', '--exclude-type', '--out')
|
||||
'pack' = @('--root', '--for', '--stage', '--depth', '--budget', '--format', '--include-type', '--exclude-type', '--out')
|
||||
@@ -129,6 +131,12 @@ Register-ArgumentCompleter -Native -CommandName gsp -ScriptBlock {
|
||||
ForEach-Object { New-GspCompletion $_ }
|
||||
}
|
||||
|
||||
if ($command -eq 'fields') {
|
||||
return @($script:GspFlags[$command]) |
|
||||
Where-Object { $_ -like "$wordToComplete*" } |
|
||||
ForEach-Object { New-GspCompletion $_ }
|
||||
}
|
||||
|
||||
if (@('trace', 'flatten', 'pack', 'links', 'impact', 'graph') -contains $command) {
|
||||
return Get-GspIds |
|
||||
Where-Object { $_ -like "$wordToComplete*" } |
|
||||
@@ -148,7 +156,7 @@ _gsp_completion() {
|
||||
cur="${COMP_WORDS[COMP_CWORD]}"
|
||||
prev="${COMP_WORDS[COMP_CWORD-1]}"
|
||||
cmd="${COMP_WORDS[1]}"
|
||||
local commands="init ai-init version completion validate index trace flatten pack links impact message graph stage-check help"
|
||||
local commands="init ai-init version completion validate index fields trace flatten pack links impact message graph stage-check help"
|
||||
case "$prev" in
|
||||
--format)
|
||||
if [[ "$cmd" == "graph" ]]; then
|
||||
@@ -174,6 +182,7 @@ _gsp_completion() {
|
||||
ai-init) COMPREPLY=( $(compgen -W "--root --agents --skill --all --force" -- "$cur") ) ;;
|
||||
version) COMPREPLY=( $(compgen -W "--json" -- "$cur") ) ;;
|
||||
validate|index) COMPREPLY=( $(compgen -W "--root --out" -- "$cur") ) ;;
|
||||
fields) COMPREPLY=( $(compgen -W "list validate" -- "$cur") ) ;;
|
||||
trace) COMPREPLY=( $(compgen -W "--root --depth --out" -- "$cur") ) ;;
|
||||
flatten) COMPREPLY=( $(compgen -W "--root --depth --include-type --exclude-type --out" -- "$cur") ) ;;
|
||||
pack) COMPREPLY=( $(compgen -W "--root --for --stage --depth --budget --format --include-type --exclude-type --out" -- "$cur") ) ;;
|
||||
@@ -210,6 +219,7 @@ _gsp() {
|
||||
'completion'
|
||||
'validate'
|
||||
'index'
|
||||
'fields'
|
||||
'trace'
|
||||
'flatten'
|
||||
'pack'
|
||||
@@ -228,7 +238,8 @@ _gsp "$@"
|
||||
|
||||
func fishCompletionScript() string {
|
||||
return `# GSP fish completion
|
||||
complete -c gsp -f -n '__fish_use_subcommand' -a 'init ai-init version completion validate index trace flatten pack links impact message graph stage-check help'
|
||||
complete -c gsp -f -n '__fish_use_subcommand' -a 'init ai-init version completion validate index fields trace flatten pack links impact message graph stage-check help'
|
||||
complete -c gsp -n '__fish_seen_subcommand_from fields' -a 'list validate'
|
||||
complete -c gsp -n '__fish_seen_subcommand_from graph' -l format -a 'json mermaid md canvas'
|
||||
complete -c gsp -n '__fish_seen_subcommand_from pack impact' -l format -a 'json md canvas'
|
||||
complete -c gsp -n '__fish_seen_subcommand_from links' -l format -a 'json md'
|
||||
|
||||
Reference in New Issue
Block a user