Skip to content

fix: avoid eval in fish completion requests#2733

Open
puneetdixit200 wants to merge 1 commit into
mikefarah:masterfrom
puneetdixit200:fix-fish-completion-quoting
Open

fix: avoid eval in fish completion requests#2733
puneetdixit200 wants to merge 1 commit into
mikefarah:masterfrom
puneetdixit200:fix-fish-completion-quoting

Conversation

@puneetdixit200

Copy link
Copy Markdown

Summary

  • generate fish completions through yq-specific post-processing so the completion request is invoked as a fish argument list instead of an eval string
  • keep YQ_ACTIVE_HELP=0 exported locally for the request
  • add regression coverage for the generated fish script

Fixes #2503

Testing

  • GOCACHE=/tmp/yq-2503-gocache GOMODCACHE=/tmp/yq-2503-gomodcache go test ./cmd -run TestFishCompletionDoesNotEvalCompletionRequest -count=1
  • GOCACHE=/tmp/yq-2503-gocache GOMODCACHE=/tmp/yq-2503-gomodcache go test ./cmd -count=1
  • GOCACHE=/tmp/yq-2503-gocache GOMODCACHE=/tmp/yq-2503-gomodcache go test ./... -count=1
  • PATH=/tmp/yq-2503-gobin:$PATH GOCACHE=/tmp/yq-2503-gocache GOMODCACHE=/tmp/yq-2503-gomodcache ./scripts/check.sh
  • GOCACHE=/tmp/yq-2503-gocache GOMODCACHE=/tmp/yq-2503-gomodcache go run . completion fish | rg -n 'set -l results \\(\\$requestComp 2> /dev/null\\)|eval \\$requestComp|set -lx YQ_ACTIVE_HELP 0'\n- git diff --check

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fish completions error - command substitutions not allowed in command position

1 participant