File: admin

package info (click to toggle)
ruby-clamp 1.4.0-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 364 kB
  • sloc: ruby: 2,851; makefile: 4
file content (21 lines) | stat: -rwxr-xr-x 492 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#! /usr/bin/env ruby
# frozen_string_literal: true

# An example of options and parameters

require "clamp"

Clamp do

  option "--timeout", "SECONDS", "connection timeout", default: 5, environment_variable: "MYAPP_TIMEOUT" do |x|
    Integer(x)
  end

  parameter "HOST", "server address"
  parameter "[PORT]", "server port", default: 80, environment_variable: "MYAPP_PORT"

  def execute
    puts "trying to connect to #{host} on port #{port} (waiting up to #{timeout} seconds)"
  end

end