Designing command-line interfaces
Oh, and another:Use your language's command-line option processing libraries.OptionParser in ruby and argparse in python.  There is no reason to eschew these libraries: they're part of the standard library, they require zero coupling to your app logic, and they handle all of the edge cases for free."But I can just shift the arguments", you say!  Yeah?  Great!  What if the user pipes input through STDOUT?  What if the user passes a flag, a required argument, and then another flag?  Will your script read the last flag correctly, or has the naive logic already entered "required argument processing mode"?  Just use the library.  It's a solved problem!