Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: allow trailing path flag #1519

Merged
merged 1 commit into from
Jan 24, 2023

Conversation

lkingland
Copy link
Member

@lkingland lkingland commented Jan 24, 2023

Changes

  • 🐛 fixes a bug where the --path flag would be ignored if provided after a subcommand

Updates the early-stage effectivePath method, which directly evaluates --path to use the pflag library, which implements a more permissive model for parsing flags (POSIX/GNU-style), including the ability to define a flag trailing subcommands, and is the library used by the command structs internally.

/kind bug

Release Note

Fixes a bug where --path was sometimes not evaluated.

@knative-prow knative-prow bot added kind/bug Categorizes issue or PR as related to a bug. do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. labels Jan 24, 2023
@knative-prow knative-prow bot added size/S Denotes a PR that changes 10-29 lines, ignoring generated files. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Jan 24, 2023
@lkingland lkingland requested a review from lance January 24, 2023 07:37
@lkingland lkingland marked this pull request as ready for review January 24, 2023 07:39
@knative-prow knative-prow bot removed the do-not-merge/work-in-progress Indicates that a PR should not merge because it is a work in progress. label Jan 24, 2023
@knative-prow knative-prow bot requested a review from dsimansk January 24, 2023 07:39
@codecov
Copy link

codecov bot commented Jan 24, 2023

Codecov Report

Base: 63.05% // Head: 63.34% // Increases project coverage by +0.29% 🎉

Coverage data is based on head (c875ec9) compared to base (154dd13).
Patch coverage: 100.00% of modified lines in pull request are covered.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1519      +/-   ##
==========================================
+ Coverage   63.05%   63.34%   +0.29%     
==========================================
  Files          74       75       +1     
  Lines       10768    10766       -2     
==========================================
+ Hits         6790     6820      +30     
+ Misses       3420     3390      -30     
+ Partials      558      556       -2     
Flag Coverage Δ
integration-tests 53.25% <100.00%> (-0.03%) ⬇️
unit-tests ?
unit-tests-macos-latest 53.27% <100.00%> (?)
unit-tests-ubuntu-latest 54.67% <100.00%> (?)
unit-tests-windows-latest 53.29% <100.00%> (?)

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
cmd/root.go 78.00% <100.00%> (-0.35%) ⬇️
knative/deployer.go 61.31% <0.00%> (-0.17%) ⬇️
docker/docker_client_nonlinux.go 0.00% <0.00%> (ø)
client.go 62.57% <0.00%> (+0.61%) ⬆️
docker/creds/credentials.go 73.06% <0.00%> (+1.34%) ⬆️
docker/docker_client.go 84.87% <0.00%> (+23.52%) ⬆️

Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here.

☔ View full report at Codecov.
📢 Do you have feedback about the report comment? Let us know in this issue.

Copy link
Member

@lance lance left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@knative-prow knative-prow bot added the lgtm Indicates that a PR is ready to be merged. label Jan 24, 2023
@lance
Copy link
Member

lance commented Jan 24, 2023

/approve

@knative-prow
Copy link

knative-prow bot commented Jan 24, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lance, lkingland

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@knative-prow knative-prow bot merged commit 218cc15 into knative:main Jan 24, 2023
@lance
Copy link
Member

lance commented Jan 24, 2023

/cherry-pick release-1.8

@knative-prow-robot
Copy link

@lance: #1519 failed to apply on top of branch "release-1.8":

Applying: fix: --path flag parsing
Using index info to reconstruct a base tree...
M	cmd/root.go
M	cmd/root_test.go
Falling back to patching base and 3-way merge...
Auto-merging cmd/root_test.go
CONFLICT (content): Merge conflict in cmd/root_test.go
Auto-merging cmd/root.go
CONFLICT (content): Merge conflict in cmd/root.go
error: Failed to merge in the changes.
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0001 fix: --path flag parsing
When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".

In response to this:

/cherry-pick release-1.8

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository.

@lkingland lkingland added this to the 1.9.0 Release milestone Jan 24, 2023
lance pushed a commit to lance/func that referenced this pull request Feb 15, 2023
@lkingland lkingland deleted the fix-restrictive-flag-parsing branch March 5, 2023 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/bug Categorizes issue or PR as related to a bug. lgtm Indicates that a PR is ready to be merged. size/S Denotes a PR that changes 10-29 lines, ignoring generated files.
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

None yet

3 participants