Sha256: 6da606cc465f867a0d115a0ace07bdeb02c84b88a2c13d44ae9487c73eff92bd

Contents?: true

Size: 345 Bytes

Versions: 4

Compression:

Stored size: 345 Bytes

Contents

require 'highline'
@cli = HighLine.new

def axe q, default=nil
  question = if default && !default.empty?
               "#{q} (enter for \"#{default}\"): "
             else
               "#{q}: "
             end
  ans = @cli.ask question
  ans.empty? ? default : ans.to_s
end

def axe_yes q, default="n"
  axe(q, default) =~ /^y|yes$/i
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
sup-1.2 lib/sup/util/axe.rb
sup-1.1 lib/sup/util/axe.rb
sup-1.0 lib/sup/util/axe.rb
sup-0.23 lib/sup/util/axe.rb