Sha256: 1d13a48afc84364e1c2dc838a3465869b1584ef605ab5ee56f9ad87f87464135
Contents?: true
Size: 888 Bytes
Versions: 5
Compression:
Stored size: 888 Bytes
Contents
### The following adjusts the load path so that the correct version of ### a self-contained package is found, no matter where the script is ### run from. require 'pathname' $:.unshift((Pathname.new(__FILE__).parent.parent.parent + 'lib').to_s) require 's4t-utils/load-path-auto-adjuster' require 'pp' require 'user-choices' class TwoArgExample < UserChoices::Command def add_sources(builder) builder.add_source(UserChoices::CommandLineSource, :usage, "Usage: ruby #{$0} [options] infile outfile") end def add_choices(builder) # You can specify an exact number of array elements required. builder.add_choice(:args, :length => 2) { | command_line | command_line.uses_arglist } end def execute pp @user_choices end end if $0 == __FILE__ S4tUtils.with_pleasant_exceptions do TwoArgExample.new.execute end end
Version data entries
5 entries across 5 versions & 1 rubygems