umjames / CLIKit

Tools to help you build Cocoa command-line applications
MIT License
2 stars 1 forks source link

Moving delegate callback for `isReadyToBeginExecutingWithRemainingArgume... #6

Closed levigroker closed 9 years ago

levigroker commented 9 years ago

This is a possible fix for (one aspect of) https://github.com/umjames/CLIKit/issues/2

By capturing the remainingArguments from the optionParser: didEncounterNonOptionArguments: delegate method in our delegate implementation and not directly calling the application.delegate, and then using these remaining arguments in runWithCommandlineArguments: to call the application.delegate application:isReadyToBeginExecutingWithRemainingArguments: we gain the ability to properly call application: isReadyToBeginExecutingWithRemainingArguments: under the circumstances when no non-option arguments are specified.

The only thing about this fix I'm not 100% happy with is that we are relying on our own CLIApplicationOptionParserDelegate implementation to capture the remaining arguments from the parser, which means we must directly call self.optionParserDelegate.remainingArguments to get the arguments. This means that as opposed to having a layer of abstraction we are now tied to the CLIApplicationOptionParserDelegate implementation.

umjames commented 9 years ago

@levigroker Sorry about the delay in responding to your pull requests, I'm just getting over the flu. You're right about this. I had a fix for #2 along with a passing test locally, but never pushed it. I'll push it to the development branch so it can go out with the next release. Thank you for working on it though.

levigroker commented 6 years ago

I've updated my pull request with a couple changes. Please review.