Talk:Parse command-line arguments: Difference between revisions

From Rosetta Code
Content added Content deleted
No edit summary
No edit summary
Line 20: Line 20:
./pmath.rb --fib 100
./pmath.rb --fib 100


e^power
e raised to a power


./pmath.rb -e 2
./pmath.rb -e 2

Revision as of 19:17, 6 August 2011

Reasons for this article:

  • Getopt documentation is often too sparse to be useful
  • Different languages have different pattern syntax (think C's "a:b:cd" getopt syntax)
  • As with ScriptedMain, this behavior is as useful as it is obscure.
  • getopt is not Google-friendly: the results tend to be C programs embedding the language in question.

The phone call example is just a quick example. I think we should define a more useful CLI example for each language.

pmath: Perform mathematical operations.

Examples:

Usage

./pmath.rb -h

Fibonacci

./pmath.rb --fib 100

e raised to a power

./pmath.rb -e 2

--User:Mcandre