Sha256: 8fa081dce52cc375d1f6bbc647f0ed857d748bda17cb26b90aa84bb14d57cf8c
Contents?: true
Size: 596 Bytes
Versions: 1
Compression:
Stored size: 596 Bytes
Contents
#! /usr/bin/env ruby # An example of default values and methods require "clamp" require "highline" Clamp do option ["-U", "--user"], "USER", "user name", :environment_variable => "THE_USER", :default => "bob" option ["-P", "--password"], "PASSWORD", "password", :environment_variable => "THE_PASSWORD" def execute puts "User: #{user}, Password: #{password}" end private def default_password terminal.ask("Password [#{user}]: ") { |q| q.echo = '*' } end def terminal tty = open("/dev/tty", "w+") HighLine.new(tty, tty) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
clamp-1.0.1 | examples/defaulted |