Sha256: 5d54ea52c7dcb629f89949792742f9eb023a562d61ed9b6a127cabf835eda12c

Contents?: true

Size: 807 Bytes

Versions: 4

Compression:

Stored size: 807 Bytes

Contents

#!/usr/bin/env ruby

require 'hss'

My_Handler = HSS::Handler.new(:config => ENV['HSS_CONFIG'])

if ARGV == ['version']
  puts HSS::VERSION
  exit
elsif ARGV == ['help'] || ARGV.empty?
  puts 'How to use:'
  puts '(what you type) -> (where it takes you)'
  My_Handler.patterns.each { |pattern| puts pattern['example'] }
  exit
end

short_host = ARGV.delete_at(ARGV.find_index { |x| x[0, 1] != '-' } || 0)
args = ARGV.reduce('') { |a, e| a + " '" + e.gsub(/([$"])/, '\1') + "'" }
command = ENV.include?('HSS_DEBUG') ? 'echo ssh' : 'ssh'

begin
  long_host = My_Handler.handle short_host
rescue NameError
  exec "#{ENV['HSS_PASS']} #{args} #{short_host}" if ENV.include? 'HSS_PASS'
  raise
end

$stdout.syswrite "\033]0;#{short_host}\007" if $stdout.tty? && $stdin.tty?
exec "#{command} #{long_host} #{args}"

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
hss-1.0.0 bin/hss
hss-0.2.11 bin/hss
hss-0.2.10 bin/hss
hss-0.2.9 bin/hss