lib/dogids/base.rb in dogids-cli-0.0.18 vs lib/dogids/base.rb in dogids-cli-0.0.19

- old
+ new

@@ -1,8 +1,9 @@ require "json" require "net/http" require "thor" +require "user_config" module Dogids class Cli < Thor include Thor::Actions # Add the ablitity to print help for commands like: @@ -38,10 +39,22 @@ File.expand_path("../../../resources", __FILE__) end private + def get_config_url(location) + config_file = set_config_location + if config_file.key?("#{location}") then + return config_file["#{location}"] + else + say("URL/IP hasn't been set for #{location} \n") + say("Please set this first by running: \n") + say("dogids config #{location}","\e[32m") + return false + end + end + # Print a heading to the terminal for commands that are going to be run. # @param heading [String] def print_heading(heading) puts "-----> #{heading}" end @@ -57,8 +70,15 @@ # Run a command with Bash after first printing the command to the terminal. # @param command [String] def run_command(command) print_command(command) `#{command}` + end + + # Access local configuration file + # @param file [String] + def set_config_location + config = UserConfig.new('.dogids') + config['conf.yaml'] end end end