Sha256: e40a8661c76137f759f1ea9b99edd69e8fbb92c2c5068e7eecce81b106948c66
Contents?: true
Size: 730 Bytes
Versions: 2
Compression:
Stored size: 730 Bytes
Contents
command :ssh do |c| c.summary = 'Connects to a host or a container with SSH' c.syntax = 'ops ssh [host_name] [container_name]' c.description = "SSH connection to host or one of its containers if write [container_name]" c.example "Connects to host:", 'ops ssh example.com' c.example "Connects to a container:", 'ops ssh example.com www' c.action do |args, options| host = args[0] user = Ops::DEFAULT_USER if args.count == 1 ssh_port = 22 else container = args[1] containers = Docker::containers_for(host) ssh_port = Docker::get_container_port containers[container] end command = "ssh #{user}@#{host} -p #{ssh_port}" puts "CMD: #{command}" exec command end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
open-dock-0.1.8 | lib/open-dock/commands/ssh_host.rb |
open-dock-0.1.7 | lib/open-dock/commands/ssh_host.rb |