Cocoa’s NSUserDefaults class can also be used as a crude form of command-line processing. NSUserDefaults automatically takes parameters of the form -parameter value and adds them to the defaults domain NSArgumentDomain. Every parameter must take a single argument. You cannot have optional arguments or parameters with no arguments when using this technique.
This is a volatile domain, so its values will not be saved to the user preferences. You probably do not want to use NSUserDefaults as the main configuration interface for command-line programs because it is inflexible, but it can be useful when you want to supply some optional command-line options. This is handy for supplying debugging or testing flags to a GUI program.