Skip to content

Instantly share code, notes, and snippets.

@postmodern
Last active December 31, 2015 05:19
Show Gist options
  • Select an option

  • Save postmodern/7939687 to your computer and use it in GitHub Desktop.

Select an option

Save postmodern/7939687 to your computer and use it in GitHub Desktop.

Revisions

  1. postmodern revised this gist Dec 13, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -1,6 +1,6 @@
    require 'optparse'

    options = OptionParser.new('test') do |opts|
    options = OptionParser.new("usage: #{$0}") do |opts|
    opts.on('-f','--file FILE','loads a file') do |file|
    puts "loading file #{file}"

  2. postmodern revised this gist Dec 13, 2013. 1 changed file with 1 addition and 0 deletions.
    1 change: 1 addition & 0 deletions gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -4,6 +4,7 @@
    opts.on('-f','--file FILE','loads a file') do |file|
    puts "loading file #{file}"

    opts.separator "#{file} options:"
    opts.on('-c','--custom') do
    puts "custom option defined by file #{file}"
    end
  3. postmodern revised this gist Dec 13, 2013. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion gistfile1.rb
    Original file line number Diff line number Diff line change
    @@ -2,7 +2,7 @@

    options = OptionParser.new('test') do |opts|
    opts.on('-f','--file FILE','loads a file') do |file|
    puts "loading file"
    puts "loading file #{file}"

    opts.on('-c','--custom') do
    puts "custom option defined by file #{file}"
  4. postmodern renamed this gist Dec 13, 2013. 1 changed file with 0 additions and 0 deletions.
    File renamed without changes.
  5. postmodern created this gist Dec 13, 2013.
    13 changes: 13 additions & 0 deletions gistfile1.txt
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,13 @@
    require 'optparse'

    options = OptionParser.new('test') do |opts|
    opts.on('-f','--file FILE','loads a file') do |file|
    puts "loading file"

    opts.on('-c','--custom') do
    puts "custom option defined by file #{file}"
    end
    end
    end

    options.parse(ARGV)