• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Command-line parsing
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Command-line parsing (From: Fritz Anderson <email@hidden>)
 >Re: Command-line parsing (From: Alastair Houghton <email@hidden>)

  • Prev by Date: Re: Debugger hangs?
  • Next by Date: Re: How to force NSMenu to redraw its menu items?
  • Previous by thread: Re: Command-line parsing
  • Next by thread: Re: Command-line parsing
  • Index(es):
    • Date
    • Thread