lib/ssh/manager/client.rb in ssh-manager-1.0.0 vs lib/ssh/manager/client.rb in ssh-manager-1.0.1

- old
+ new

@@ -1,10 +1,11 @@ #require_relative "../manager" require 'optparse' require_relative 'db' require_relative 'client' require_relative 'version' +require 'byebug' module SSH module Manager class Client @@ -22,24 +23,30 @@ puts 'Adding ..' cli.new(@options).add_connection(@options[:add]) elsif @options[:connect] puts 'Connecting ..' cli.new(@options).connect_to(@options[:connect]) + elsif @options[:transfer_file] + puts 'Transfering file..' + cli.new(@options).transfer_file(@options[:transfer_file], @argv[2], @argv[3]) elsif @options[:delete] puts 'Deleting ..' cli.new(@options).delete(@options[:delete]) elsif @options[:list] puts 'Listing ..' cli.new(@options).list_all + elsif @options[:upgrade] + puts 'Checking for new updates ..' + cli.new(@options).update_available elsif @options[:update] puts 'Updating ..' cli.new(@options).update(@options[:update]) elsif @options[:multi] - puts 'Connecting to multiple ips' + puts 'Connecting to multiple ips..' cli.new(@options).multiple_connection(@options[:multi]) elsif @options[:transfer_key] - puts 'Transfering key' + puts 'Transfering key..' cli.new(@options).transfer_key(@options[:transfer_key]) elsif @options[:search] puts 'Searching ..' cli.new(@options).search_for(@options[:search]) # elsif @options[:settings] @@ -61,10 +68,14 @@ end @options[:transfer_key] = false opts.on( '-t', '--transferkey id', 'transfer key to <id>' ) do |opt| @options[:transfer_key] = opt end + @options[:transfer_file] = false + opts.on( '-r', '--transferfile filename', 'file or dir / connection_ID / dest_path(default is /home/user/)' ) do |opt| + @options[:transfer_file] = opt + end @options[:connect] = false opts.on( '-c', '--connect id', 'connect to <id>' ) do |opt| @options[:connect] = opt end @options[:delete] = false @@ -84,9 +95,13 @@ @options[:multi] = opt end @options[:list] = false opts.on( '-l', '--list', 'list all connections' ) do @options[:list] = true + end + @options[:upgrade] = false + opts.on( '-g', '--upgrade', 'checks for upgrade' ) do + @options[:upgrade] = true end opts.on( '-h', '--help', 'Display this screen' ) do puts opts exit end