Sha256: 1c3437feb7c828313cf45cd48321fee10c8b669ca3bb5412228fd505cc08870b
Contents?: true
Size: 1.85 KB
Versions: 3
Compression:
Stored size: 1.85 KB
Contents
#!/usr/bin/env ruby require 'cliutils.rb' # include CLIUtils::PrettyIO # # warn('test') include CLIUtils::Messenging # # # file_logger = Logger.new('file.txt') # puts '' # messenger.info('This should only appear in STDOUT.') # messenger.attach(file_logger) # messenger.warn('This warning should appear in STDOUT and file.txt') # messenger.error('This error should appear in STDOUT and file.txt') # messenger.debug('This debug message should only appear in file.txt') # messenger.detach(file_logger) # messenger.section('This section message should appear only in STDOUT') # puts '' # include CLIUtils::Configuration load_configuration('~/.test') configuration.add_section(:user_data) configuration.add_section(:program_data) configuration.delete_section(:program_data) configuration.user_data.merge!(username: 'bob') configuration.save # # p = CLIUtils::Prefs.new(File.join(File.expand_path(File.dirname(__FILE__)),'..', 'test/test_files/prefstest.yaml')) # # # arr = [{:prompt=>"What is the hostname of your DD-WRT router?", :default=>"192.168.1.1", :key=>"hostname", :section=>"ssh_info"}, {:prompt=>"What is the SSH username of your DD-WRT router?", :default=>"root", :key=>"username", :section=>"ssh_info"}, {:prompt=>"What SSH port does your DD-WRT router use?", :default=>22, :key=>"port", :section=>"ssh_info"}, {:prompt=>"How do you use password or key authentication?", :default=>"password", :key=>"auth_method", :section=>"ssh_info", :options=>["password", "key"]}, {:prompt=>"Where is your key located?", :default=>"~/.ssh", :key=>"key_location", :section=>"ssh_info", :requirements=>[{:key=>"auth_method", :value=>"key"}]}, {:prompt=>"What is your password?", :key=>"password", :section=>"ssh_info", :requirements=>[{:key=>"auth_method", :value=>"password"}]}] # # p = CLIUtils::Prefs.new(arr) # # # p p.prompts # p.ask # configuration.ingest_prefs(p) # configuration.save
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
cliutils-1.0.2 | bin/cliutils |
cliutils-1.0.1 | bin/cliutils |
cliutils-1.0.0 | bin/cliutils |