Talk:Parse command-line arguments: Difference between revisions

From Rosetta Code
Content added Content deleted
(→‎Ruby example: new section)
(→‎Task needs a task: new section)
Line 30: Line 30:


What if both <tt>-d</tt> and <tt>-e</tt> are given? Then only the last one applies? That seems kinda fragile. --[[Special:Contributions/166.250.34.11|166.250.34.11]] 19:47, 8 August 2011 (UTC)
What if both <tt>-d</tt> and <tt>-e</tt> are given? Then only the last one applies? That seems kinda fragile. --[[Special:Contributions/166.250.34.11|166.250.34.11]] 19:47, 8 August 2011 (UTC)

== Task needs a task ==

The task description should probably specify what is to be accomplished here. --[[User:Rdm|Rdm]] 00:32, 9 August 2011 (UTC)

Revision as of 00:32, 9 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

Command line parameter conventions

I have some (currently incomplete) documentation relating to command line parameter conventions that you may wish to consider as part of this project.

http://computerconventions.wikia.com/wiki/Command_line_parameter_conventions

I have also got some part written code that will follow the conventions, but the project is in its infancy, and not ready for prime time here on rosettacode (because it is in a language that I am still learning). It will eventually become available as library code, providing an alternative parser to getopt (but using different conventions). Markhobley 19:37, 6 August 2011 (UTC)

Ruby example

What if both -d and -e are given? Then only the last one applies? That seems kinda fragile. --166.250.34.11 19:47, 8 August 2011 (UTC)

Task needs a task

The task description should probably specify what is to be accomplished here. --Rdm 00:32, 9 August 2011 (UTC)