Sha256: b86e032030b2324d133ab8d118f6197178f3ad397e9a0c81932d34b2aebefe36

Contents?: true

Size: 833 Bytes

Versions: 1

Compression:

Stored size: 833 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['HSS_COMMAND'] || 'ssh'
command.prepend('echo ') if ENV['HSS_DEBUG']

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

1 entries across 1 versions & 1 rubygems

Version Path
hss-1.0.1 bin/hss