Getoption long question

opts = GetoptLong.new(_
···[ “–create-test”, “-T”, GetoptLong::NO_ARGUMENT ],
)

what if I don’t actually want short options such as the -T? (running out
of suitable letters, or something)

How would I use it then?

db

···


A.D. 1844: Samuel Morse invents Morse code. Cryptography export
restrictions prevent the telegraph’s use outside the U.S. and Canada.

opts = GetoptLong.new(_
···[ “–create-test”, “-T”, GetoptLong::NO_ARGUMENT ],
)

what if I don’t actually want short options such as the -T? (running out
of suitable letters, or something)

How would I use it then?

opts = GetoptLong.new(
[ “–create-test”, GetoptLong::NO_ARGUMENT ]
)

The short options are optional. GetoptLong is very flexible. You can
have as many or as few short and long options as you like.

$ cat test.rb
require ‘getoptlong’

opts = GetoptLong.new(
[ “–create-test”, GetoptLong::NO_ARGUMENT ]
)
$ ruby test.rb
$

Cheers,

···


Daniel Carrera | OpenPGP KeyID: 9AF77A88
PhD grad student. |
Mathematics Dept. | “To understand recursion, you must first
UMD, College Park | understand recursion”.

I recommend using optparse rather than GetoptLong, but you may decide
differently. Information about optparse can be found here:

http://learningruby.com/usingoptparse.shtml

Regards,

Mark

···

On Oct 29, 2003, at 2:22 PM, Daniel Bretoi wrote:

opts = GetoptLong.new(_
···[ “–create-test”, “-T”, GetoptLong::NO_ARGUMENT ],
)

what if I don’t actually want short options such as the -T? (running
out
of suitable letters, or something)

How would I use it then?

opts = GetoptLong.new(_
???[ “–create-test”, “-T”, GetoptLong::NO_ARGUMENT ],
)

what if I don’t actually want short options such as the -T? (running out
of suitable letters, or something)

How would I use it then?

opts = GetoptLong.new(
[ “–create-test”, GetoptLong::NO_ARGUMENT ]
)

The short options are optional. GetoptLong is very flexible. You can
have as many or as few short and long options as you like.

$ cat test.rb
require ‘getoptlong’

opts = GetoptLong.new(
[ “–create-test”, GetoptLong::NO_ARGUMENT ]
)
$ ruby test.rb
$

Thank you. I swear I tried this before asking, and I got errors. Once
you ask…

db

···

On Thu, Oct 30, 2003 at 05:35:04AM +0900, Daniel Carrera wrote:

Cheers,

Daniel Carrera | OpenPGP KeyID: 9AF77A88
PhD grad student. |
Mathematics Dept. | “To understand recursion, you must first
UMD, College Park | understand recursion”.


A.D. 1844: Samuel Morse invents Morse code. Cryptography export
restrictions prevent the telegraph’s use outside the U.S. and Canada.