• 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: Alastair Houghton <email@hidden>
  • Date: Wed, 21 Jul 2010 16:03:39 +0100

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

  • Follow-Ups:
    • Re: Command-line parsing
      • From: Daniel DeCovnick <email@hidden>
References: 
 >Command-line parsing (From: Fritz Anderson <email@hidden>)

  • Prev by Date: Re: Knowing how a Text Editing Session ended
  • Next by Date: Re: WebView pagination for printing
  • Previous by thread: Command-line parsing
  • Next by thread: Re: Command-line parsing
  • Index(es):
    • Date
    • Thread