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