Sha256: c7317ce36449130b80267745b10c423a58ce545df920538c03705f49cf998ce8
Contents?: true
Size: 617 Bytes
Versions: 3
Compression:
Stored size: 617 Bytes
Contents
#! /usr/bin/env ruby # frozen_string_literal: true # 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
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
clamp-1.3.2 | examples/defaulted |
clamp-1.3.1 | examples/defaulted |
clamp-1.3.0 | examples/defaulted |