File: flipflop

package info (click to toggle)
ruby-clamp 1.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 312 kB
  • sloc: ruby: 2,359; makefile: 4
file content (29 lines) | stat: -rwxr-xr-x 434 bytes parent folder | download | duplicates (4)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
#! /usr/bin/env ruby

# An example of subcommands

require "clamp"
require "clamp/version"

Clamp do

  option ["--version", "-v"], :flag, "Show version" do
    puts "Powered by Clamp-#{Clamp::VERSION}"
    exit(0)
  end

  self.default_subcommand = "flip"

  subcommand "flip", "flip it" do
    def execute
      puts "FLIPPED"
    end
  end

  subcommand "flop", "flop it" do
    def execute
      puts "FLOPPED"
    end
  end

end