Fix default command used for __completeNoDesc alias#2568
Fix default command used for __completeNoDesc alias#2568mikefarah merged 1 commit intomikefarah:masterfrom
Conversation
|
Hmm the build failed on gosec That version is right here: It works locally. Maybe it just needs a retry? |
|
Yeah not sure why it fails like that sometime :/ |
There was a problem hiding this comment.
Pull request overview
This PR fixes the handling of the __completeNoDesc completion command to prevent it from triggering the default eval command logic. The __completeNoDesc command is a Cobra alias for __complete used specifically for PowerShell tab-completion.
Changes:
- Updated the main function logic to exclude
__completeNoDescfrom the default command fallback - Added comprehensive test coverage to verify the fix works correctly
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| yq.go | Added __completeNoDesc to the condition that prevents default command execution for completion commands |
| yq_test.go | Added test cases to verify __completeNoDesc is handled correctly alongside __complete |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| } | ||
|
|
||
| func TestMainFunctionWithCompletionNoDescCommand(t *testing.T) { | ||
| // Test that __complete command doesn't trigger default command logic |
There was a problem hiding this comment.
The comment incorrectly states '__complete' when the test is for '__completeNoDesc'. Update to: 'Test that __completeNoDesc command doesn't trigger default command logic'.
| // Test that __complete command doesn't trigger default command logic | |
| // Test that __completeNoDesc command doesn't trigger default command logic |
This PR contains the following updates: | Package | Update | Change | |---|---|---| | [forgejo-runner-service-yq](https://github.com/mikefarah/yq) | minor | `v4.50.1` → `v4.52.2` | --- ### Release Notes <details> <summary>mikefarah/yq (forgejo-runner-service-yq)</summary> ### [`v4.52.2`](https://github.com/mikefarah/yq/releases/tag/v4.52.2) [Compare Source](mikefarah/yq@v4.52.1...v4.52.2) - Fixed bad instructions file breaking go-install ([#​2587](mikefarah/yq#2587)) Thanks [@​theyoprst](https://github.com/theyoprst) - Fixed TOML table scope after comments ([#​2588](mikefarah/yq#2588)) Thanks [@​tomers](https://github.com/tomers) - Multiply uses a readonly context ([#​2558](mikefarah/yq#2558)) - Fixed merge globbing wildcards in keys ([#​2564](mikefarah/yq#2564)) - Fixing TOML subarray parsing issue ([#​2581](mikefarah/yq#2581)) ### [`v4.52.1`](https://github.com/mikefarah/yq/releases/tag/v4.52.1): - TOML roundtrip and more! [Compare Source](mikefarah/yq@v4.50.1...v4.52.1) - TOML encoder support - you can now roundtrip! [#​1364](mikefarah/yq#1364) - Parent now supports negative indices, and added a 'root' command for referencing the top level document - Fixed scalar encoding for HCL - Add --yaml-compact-seq-indent / -c flag for compact sequence indentation ([#​2583](mikefarah/yq#2583)) Thanks [@​jfenal](https://github.com/jfenal) - Add symlink check to file rename util ([#​2576](mikefarah/yq#2576)) Thanks [@​Elias-elastisys](https://github.com/Elias-elastisys) - Powershell fixed default command used for \_\_completeNoDesc alias ([#​2568](mikefarah/yq#2568)) Thanks [@​teejaded](https://github.com/teejaded) - Unwrap scalars in shell output mode. ([#​2548](mikefarah/yq#2548)) Thanks [@​flintwinters](https://github.com/flintwinters) - Added K8S KYAML output format support ([#​2560](mikefarah/yq#2560)) Thanks [@​robbat2](https://github.com/robbat2) - Bumped dependencies - Special shout out to [@​ccoVeille](https://github.com/ccoVeille) for reviewing my PRs! Thanks to everyone that contributed ❤️ </details> --- ### Configuration 📅 **Schedule**: Branch creation - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC), Automerge - Between 12:00 AM and 03:59 AM ( * 0-3 * * * ) (UTC). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this PR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this PR, check this box --- This PR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Mi40IiwidXBkYXRlZEluVmVyIjoiNDIuOTIuNCIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiS2luZC9EZXBlbmRlbmN5VXBkYXRlIiwicnVuLWVuZC10by1lbmQtdGVzdHMiXX0=--> Reviewed-on: https://code.forgejo.org/forgejo/runner/pulls/1347 Reviewed-by: Mathieu Fenniak <mfenniak@noreply.code.forgejo.org> Co-authored-by: Renovate Bot <bot@kriese.eu> Co-committed-by: Renovate Bot <bot@kriese.eu>
This MR contains the following updates: | Package | Update | Change | |---|---|---| | [mikefarah/yq](https://github.com/mikefarah/yq) | minor | `v4.50.1` → `v4.52.4` | MR created with the help of [el-capitano/tools/renovate-bot](https://gitlab.com/el-capitano/tools/renovate-bot). **Proposed changes to behavior should be submitted there as MRs.** --- ### Release Notes <details> <summary>mikefarah/yq (mikefarah/yq)</summary> ### [`v4.52.4`](https://github.com/mikefarah/yq/releases/tag/v4.52.4) [Compare Source](mikefarah/yq@v4.52.2...v4.52.4) - Dropping windows/arm - no longer supported in cross-compile - Fixing comments in TOML arrays ([#​2592](mikefarah/yq#2592)) - Bumped dependencies ### [`v4.52.2`](https://github.com/mikefarah/yq/releases/tag/v4.52.2) [Compare Source](mikefarah/yq@v4.52.1...v4.52.2) - Fixed bad instructions file breaking go-install ([#​2587](mikefarah/yq#2587)) Thanks [@​theyoprst](https://github.com/theyoprst) - Fixed TOML table scope after comments ([#​2588](mikefarah/yq#2588)) Thanks [@​tomers](https://github.com/tomers) - Multiply uses a readonly context ([#​2558](mikefarah/yq#2558)) - Fixed merge globbing wildcards in keys ([#​2564](mikefarah/yq#2564)) - Fixing TOML subarray parsing issue ([#​2581](mikefarah/yq#2581)) ### [`v4.52.1`](https://github.com/mikefarah/yq/releases/tag/v4.52.1): - TOML roundtrip and more! [Compare Source](mikefarah/yq@v4.50.1...v4.52.1) - TOML encoder support - you can now roundtrip! [#​1364](mikefarah/yq#1364) - Parent now supports negative indices, and added a 'root' command for referencing the top level document - Fixed scalar encoding for HCL - Add --yaml-compact-seq-indent / -c flag for compact sequence indentation ([#​2583](mikefarah/yq#2583)) Thanks [@​jfenal](https://github.com/jfenal) - Add symlink check to file rename util ([#​2576](mikefarah/yq#2576)) Thanks [@​Elias-elastisys](https://github.com/Elias-elastisys) - Powershell fixed default command used for \_\_completeNoDesc alias ([#​2568](mikefarah/yq#2568)) Thanks [@​teejaded](https://github.com/teejaded) - Unwrap scalars in shell output mode. ([#​2548](mikefarah/yq#2548)) Thanks [@​flintwinters](https://github.com/flintwinters) - Added K8S KYAML output format support ([#​2560](mikefarah/yq#2560)) Thanks [@​robbat2](https://github.com/robbat2) - Bumped dependencies - Special shout out to [@​ccoVeille](https://github.com/ccoVeille) for reviewing my MRs! Thanks to everyone that contributed ❤️ </details> --- ### Configuration 📅 **Schedule**: Branch creation - At any time (no schedule defined), Automerge - At any time (no schedule defined). 🚦 **Automerge**: Disabled by config. Please merge this manually once you are satisfied. ♻ **Rebasing**: Whenever MR becomes conflicted, or you tick the rebase/retry checkbox. 🔕 **Ignore**: Close this MR and you won't be reminded about this update again. --- - [ ] <!-- rebase-check -->If you want to rebase/retry this MR, check this box --- This MR has been generated by [Renovate Bot](https://github.com/renovatebot/renovate). <!--renovate-debug:eyJjcmVhdGVkSW5WZXIiOiI0Mi45Ni4yIiwidXBkYXRlZEluVmVyIjoiNDMuMTAuMyIsInRhcmdldEJyYW5jaCI6Im1haW4iLCJsYWJlbHMiOlsiUmVub3ZhdGUgQm90IiwiYXV0b21hdGlvbjpib3QtYXV0aG9yZWQiLCJkZXBlbmRlbmN5LXR5cGU6Om1pbm9yIl19-->
Fixes: #2482
__completeNoDescis an alias for__completehttps://github.com/spf13/cobra/blob/6dec1ae26659a130bdb4c985768d1853b0e1bc06/completions.go#L234
It is used for Powershell tab-completion
before:
after: