I'm writing a Foundation tool that will take both options and pathname arguments.
If you use NSUserDefaults, you can handle key-value options (-threshold 17) pretty easily, but this has limitations. I don't see how it can be graceful for * Two-hyphen options (chatty --verbose). * Non-value options (ls -a). * Single-item key-value options (chatty --verbose=3 -or- chatty -v3). * Concatenated options (ls -al) I also don't know what you do about "normal" arguments (ls -al /Users/fritza) without using NSUserDefaults _and_ running through [[NSProcessInfo processInfo] arguments] with at least a minimal state machine, which defeats the purpose. Enough complaining. Correct me if I'm wrong. I remember from 2001 or so that there was an open-source framework inherited from the OpenStep days, that included a helper for getopt(3) sorts of tasks, but for the life of me, I can't remember its name, and I don't know where it would be hosted or whether it would be compatible with today's Foundation framework. Yes, iterating through [[NSProcessInfo processInfo] arguments] and parsing for myself is the ultimate option, but if it's a solved problem, why make all the mistakes again? Google doesn't turn up much, beyond the NSUserDefaults trick. Any ideas? — F _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com