lib/sapos/print/cli.rb in sapos-print-1.0.6 vs lib/sapos/print/cli.rb in sapos-print-1.0.7

- old
+ new

@@ -10,15 +10,26 @@ config = {} url = ask("Configuration URL") response = RestClient.get(url) data = JSON.parse(response) + + config_file = "#{Sapos::Print.app_directory}/config.yml" + user_id = nil + if File.exist?(config_file) + template = ERB.new(File.read(config_file)) + result = YAML.load(template.result(binding)) + user_id = result[:user_id] + end + + user_id = SecureRandom.uuid if user_id.nil? config[:q] = data["channel"] config[:key] = data["key"] config[:printer] = ask("Printer Name: ") config[:adapter] = ask("Printer Adapter: ", limited_to: ["console", "cups", "windows"]) config[:interface] = ask("Interface", limited_to: ["text", "escp"]) + config[:user_id] = user_id if yes?("Are you sure that you want to write the configuration file?") Sapos::Print::Configuration.write(config) ap config say "Configuration Saved! Cheers" \ No newline at end of file