Sha256: 275958bb752104b64592dfc6822191751dd40e3bbf0bbdcb24efb9159bf69c34

Contents?: true

Size: 492 Bytes

Versions: 3

Compression:

Stored size: 492 Bytes

Contents

#! /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

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
clamp-1.3.2 examples/admin
clamp-1.3.1 examples/admin
clamp-1.3.0 examples/admin