Sha256: ed4f86141fa68e16f73b4cd2459578f95cb410a606600a6630591d2119b1f695
Contents?: true
Size: 906 Bytes
Versions: 1
Compression:
Stored size: 906 Bytes
Contents
class Delegator # # Say hello # # SYNOPSIS # #{program_name} #{command_name} [--capitalize] [WHO] # # OPTIONS # #{summarized_options} # # DESCRIPTION # Without any argument, says hello to the world. When a single argument # is given says hello to the user. # class HelloWorld < Quickl::Command(__FILE__, __LINE__) # Install command options options do |opt| # Capitalize user name? opt.on("--capitalize", "-c", "Capitalize user name") do @capitalize = true end end # Execute the command on some arguments def execute(args) if args.size <= 1 name = args.first || "world" name = name.capitalize if @capitalize puts "Hello #{name}!" else raise Quickl::InvalidArgument, "Useless arguments: #{args.join(' ')}" end end end # class HelloWorld end # class Delegator
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
quickl-0.2.0 | examples/delegator/lib/hello_world.rb |