GBCli icon indicating copy to clipboard operation
GBCli copied to clipboard

--no-whatever option doesn't work

Open CTMacUser opened this issue 9 years ago • 2 comments

(I'm using the default GBCli from CocoaPods (1.1?) with Objective-C on a Mac OS X 10.10 system running Xcode 6.2.)

I added an option that needs a negative variant. I'm using a settings object that has the corresponding property set to YES by default. Using "--no-myOption" doesn't turn off the feature, although "--myOption=0" does.

I looked into the section of GBCommandLineParser.m that handles the "--no-" options. The debugger shows that the "--no-" variant is being registered. Then I checked into the part of the file that handles writing the option's value into the results dictionary. The write occurs, but it's under the "no-myOption" key. That's the bug; my code never sees the change since the regular and negative variants are supposed to use the same key.

CTMacUser avatar Apr 09 '15 16:04 CTMacUser

I use two layers of setting objects, like the README sample code. I have nothing by default in the direct "command line" settings, but have all the flags in the base "factory" settings. When I change the default value of "myOption" to NO, like my other flags, both the "--myOption" and "--no-myOption" work as expected. So maybe the bug is somewhere else....

CTMacUser avatar Apr 09 '15 17:04 CTMacUser

Thanks, will take a look.

tomaz avatar Apr 10 '15 05:04 tomaz