Re: Command-line parsing
Re: Command-line parsing
- Subject: Re: Command-line parsing
- From: Daniel DeCovnick <email@hidden>
- Date: Wed, 21 Jul 2010 14:33:45 -0700
I for one had no idea that existed.
-Daniel
On Jul 21, 2010, at 8:03 AM, Alastair Houghton wrote:
On 21 Jul 2010, at 15:54, Fritz Anderson wrote:
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)
[snip]
Maybe I'm missing something, but why not just use getopt_long()?
That does the parsing for you, and matches what other programs on
the system do.
Kind regards,
Alastair.
--
http://alastairs-place.net
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden