Sha256: afdab0da3df42631631d9b7e299bdea8757bb76e2529c9725c813d6cea057519

Contents?: true

Size: 1.04 KB

Versions: 8

Compression:

Stored size: 1.04 KB

Contents

$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require 'command_lion'
require 'pry'

CommandLion::App.run do

  name "Hello World!"
  version "1.0.0"
  description "Your typical, contrived application example."

  command :rainbow do
    description "STDOUT looks so much better with rainbows."
    flag "--rainbow"
    action do
      require "lolize/auto"
    end
  end

  command :hello do
    description "A simple option to say hello!"
    
    type :string
    flag "hello"
    
    default "world"

    action do
      puts "Hello #{argument}!"
    end
  end
  
  command :hello_multi do
    description "A simple option to say hello to multiple people!"
    
    type :strings
    delimiter ","

    flag "hellos"
    
    default ["bob", "alice"]

    action do
      arguments.each do |argument|
        next if argument == options[:ignore].argument
        puts "Hello #{argument}!"
      end
    end
    
    option :ignore do
      description "Optionally ignore one person."
      flag "--ignore"
      type :string
    end
  end

end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
command_lion-2.0.1 examples/example2.rb
command_lion-2.0.0 examples/example2.rb
command_lion-1.0.4 examples/example2.rb
command_lion-1.0.3geff examples/example2.rb
command_lion-1.0.3 examples/example2.rb
command_lion-1.0.2 examples/example2.rb
command_lion-1.0.1 examples/example2.rb
command_lion-1.0.0 examples/example2.rb