pact-foundation / pact_broker-client

A Ruby and CLI client for the Pact Broker. Publish and retrieve pacts and verification results.
MIT License
69 stars 47 forks source link

`--ignore` parameter order matters #171

Closed dimkin-eu closed 2 months ago

dimkin-eu commented 2 months ago

I discovered by accident that the order of the parameters is crucial; otherwise, it can lead to unexpected errors.

docker run --rm -it pactfoundation/pact-cli:latest /bin/sh   
# pact-broker version
1.76.0
~ #  pact-broker can-i-deploy --pacticipant someName --ignore someOtherName --version 9ec0ec93 --to-environment uat --broker-base-url URL --broker-username user --broker-password pass 

The version must be specified using `--version VERSION`, `--branch BRANCH` `--latest`, `--latest TAG`, or `--all TAG` for pacticipant someName
~ #  pact-broker can-i-deploy --pacticipant someName --version 9ec0ec93 --ignore someOtherName --to-environment uat --broker-base-url URL --broker-username  user --broker-password pass 
Computer says yes \o/ 

There is nothing about it in docs

Still there are some CLI guidelines

Guideline 11:
The order of different options relative to one another should not matter, 
unless the options are documented as mutually-exclusive 
and such an option is documented to override any incompatible options preceding it...
mefellows commented 2 months ago
Screenshot 2024-09-05 at 6 22 16 PM

Well, it does say this

dimkin-eu commented 2 months ago

oh mama, then closing as user error ? :) image

mefellows commented 2 months ago

I think so. If there are other strange variants, you might consider re-opening. Thor (the underlying CLI library) does have its quirks, but changing the behaviour would result in a breaking change of sorts, so we'd possibly need to consider a major version bump just to straighten it out!