HEX
Server: Apache
System: Linux vps-cdc32557.vps.ovh.ca 5.15.0-156-generic #166-Ubuntu SMP Sat Aug 9 00:02:46 UTC 2025 x86_64
User: hanode (1017)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: //usr/share/ri/3.0.0/system/GetoptLong/cdesc-GetoptLong.ri
U:RDoc::NormalClass[iI"GetoptLong:ET@I"Object;To:RDoc::Markup::Document:@parts[o;;[o:RDoc::Markup::Paragraph;[I"PThe GetoptLong class allows you to parse command line options similarly to ;TI"Othe GNU getopt_long() C library call. Note, however, that GetoptLong is a ;TI"pure Ruby implementation.;To:RDoc::Markup::BlankLineo;	;[I"LGetoptLong allows for POSIX-style options like <tt>--file</tt> as well ;TI".as single letter options like <tt>-f</tt>;T@o;	;[I"LThe empty option <tt>--</tt> (two minus symbols) is used to end option ;TI"Mprocessing. This can be particularly important if options have optional ;TI"arguments.;T@o;	;[I"'Here is a simple example of usage:;T@o:RDoc::Markup::Verbatim;[;I"require 'getoptlong'
;TI"
;TI"opts = GetoptLong.new(
;TI"4  [ '--help', '-h', GetoptLong::NO_ARGUMENT ],
;TI"<  [ '--repeat', '-n', GetoptLong::REQUIRED_ARGUMENT ],
;TI"3  [ '--name', GetoptLong::OPTIONAL_ARGUMENT ]
;TI")
;TI"
;TI"dir = nil
;TI"name = nil
;TI"repetitions = 1
;TI"opts.each do |opt, arg|
;TI"  case opt
;TI"    when '--help'
;TI"      puts <<-EOF
;TI"hello [OPTION] ... DIR
;TI"
;TI"-h, --help:
;TI"   show help
;TI"
;TI"--repeat x, -n x:
;TI"   repeat x times
;TI"
;TI"--name [name]:
;TI"A   greet user by name, if name not supplied default is John
;TI"
;TI"8DIR: The directory in which to issue the greeting.
;TI"      EOF
;TI"    when '--repeat'
;TI""      repetitions = arg.to_i
;TI"    when '--name'
;TI"      if arg == ''
;TI"        name = 'John'
;TI"      else
;TI"        name = arg
;TI"      end
;TI"  end
;TI"	end
;TI"
;TI"if ARGV.length != 1
;TI"0  puts "Missing dir argument (try --help)"
;TI"  exit 0
;TI"	end
;TI"
;TI"dir = ARGV.shift
;TI"
;TI"Dir.chdir(dir)
;TI"for i in (1..repetitions)
;TI"  print "Hello"
;TI"  if name
;TI"    print ", #{name}"
;TI"  end
;TI"  puts
;TI"	end
;T:@format0o;	;[I"Example command line:;T@o;;[I"hello -n 6 --name -- /tmp;T;0:
@fileI"lib/getoptlong.rb;T:0@omit_headings_from_table_of_contents_below0;
0;0[
[
I"
error;TI"R;T:publicFI"lib/getoptlong.rb;T[
I"error?;T@a;F@b[
I"
ordering;T@a;F@b[
I"
quiet;TI"RW;T;F@b[
I"quiet?;T@i;F@b[	U:RDoc::Constant[iI"VERSION;TI"GetoptLong::VERSION;T;0o;;[o;	;[I"
Version.;T;
@];0@]@cRDoc::NormalClass0U;[iI"ORDERINGS;TI"GetoptLong::ORDERINGS;T;0o;;[o;	;[I"Orderings.;T;
@];0@]@@v0U;[iI"ARGUMENT_FLAGS;TI"GetoptLong::ARGUMENT_FLAGS;T;0o;;[o;	;[I"Argument flags.;T;
@];0@]@@v0U;[iI"STATUS_TERMINATED;TI""GetoptLong::STATUS_TERMINATED;T;0o;;[;
@];0@]@@v0[[[I"
class;T[[;[[I"new;T@b[:protected[[:private[[I"
instance;T[[;[[I"	each;T@b[I"each_option;T@b[I"error_message;T@b[I"get;T@b[I"get_option;T@b[I"ordering=;T@b[I"set_options;T@b[I"terminate;T@b[I"terminated?;T@b[;[[I"set_error;T@b[;[[[U:RDoc::Context::Section[i0o;;[;
0;0[@]@]cRDoc::TopLevel