Files
ubicloud/cli-commands/vm/post/ssh.rb
Jeremy Evans de9716073c Use single argument for VM reference
This argument must currently be in the format "location/(vm-name|_vm-ubid)".
This format makes it easier to support just "vm-ubid" or "vm-name" in a
backwards compatible manner in the future.
2025-02-07 09:14:38 -08:00

19 lines
468 B
Ruby

# frozen_string_literal: true
UbiRodish.on("vm").run_on("ssh") do
options("ubi vm location-name/(vm-name|_vm-ubid) ssh [options] [-- ssh-options --] [cmd [arg, ...]]", key: :vm_ssh, &UbiCli::SSHISH_OPTS)
args(0...)
run do |argv, opts|
handle_ssh(opts) do |user:, address:|
if (i = argv.index("--"))
options = argv[0...i]
argv = argv[(i + 1)...]
end
["ssh", *options, "--", "#{user}@#{address}", *argv]
end
end
end