File: word

package info (click to toggle)
ruby-clamp 1.3.3-1
  • links: PTS, VCS
  • area: main
  • in suites: forky
  • size: 364 kB
  • sloc: ruby: 2,851; makefile: 4
file content (28 lines) | stat: -rwxr-xr-x 393 bytes parent folder | download | duplicates (2)
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
#! /usr/bin/env ruby
# frozen_string_literal: true

# Demonstrate "restful" style; parameters precede subcommands

require "clamp"

Clamp do

  banner %(
    Word ops.
  )

  parameter "WORD", "the word in question"

  subcommand "say", "Say it" do
    def execute
      puts word
    end
  end

  subcommand "shout", "Say it loud" do
    def execute
      puts word.upcase
    end
  end

end