diff --git a/src/lib/nodes/index.ts b/src/lib/nodes/index.ts index 576ab6b..9dcfd76 100644 --- a/src/lib/nodes/index.ts +++ b/src/lib/nodes/index.ts @@ -71,13 +71,13 @@ $ sf nodes set my-node-name --max-price 12.50 $ sf nodes extend my-node-name --duration 3600 --max-price 12.50 \x1b[2m# SSH into a node's current VM\x1b[0m -$ sf nodes ssh my-node-name +$ sf nodes ssh root@my-node-name \x1b[2m# View logs from a node's current VM\x1b[0m $ sf nodes logs my-node-name \x1b[2m# SSH into a specific VM\x1b[0m -$ sf nodes ssh user@vm_xxxxxxxxxxxxxxxxxxxxx +$ sf nodes ssh root@vm_xxxxxxxxxxxxxxxxxxxxx \x1b[2m# View logs from a specific VM\x1b[0m $ sf nodes logs -i vm_xxxxxxxxxxxxxxxxxxxxx diff --git a/src/lib/nodes/ssh.ts b/src/lib/nodes/ssh.ts index f5ffc2a..c781ee4 100644 --- a/src/lib/nodes/ssh.ts +++ b/src/lib/nodes/ssh.ts @@ -16,7 +16,12 @@ import { getApiUrl } from "../../helpers/urls.ts"; import { getAuthToken } from "../../helpers/config.ts"; const ssh = new Command("ssh") - .description("SSH into a VM on a node") + .description(`SSH into a VM on a node. + +Runs \`ssh\` with host keys from the API, forgoing the need to manually accept keys on first connect. +Keys are fetched asynchronously from the VM's SSH server and may take a moment to populate. + +Standard \`ssh\` behavior applies (e.g. defaults to your current username).`) .showHelpAfterError() .option("-q, --quiet", "Quiet mode", false) .option( @@ -27,8 +32,9 @@ const ssh = new Command("ssh") .addOption(jsonOption) .argument( "", - "USERNAME@HOST The (optional) username, and node name/ID or VM ID to SSH into", + "Node name, Node ID, or VM ID to SSH into.\nFollows \`ssh\` behavior (i.e. root@node or jenson@node).", ) + .usage("[options] [user@]") .allowExcessArguments(false) .addHelpText( "after", @@ -36,16 +42,13 @@ const ssh = new Command("ssh") Examples: \x1b[2m# SSH into a node's current VM\x1b[0m - $ sf nodes ssh my-node + $ sf nodes ssh root@my-node \x1b[2m# SSH with a specific username\x1b[0m $ sf nodes ssh jenson@my-node - + \x1b[2m# SSH directly to a VM ID\x1b[0m - $ sf nodes ssh vm_xxxxxxxxxxxxxxxxxxxxx - - \x1b[2m# SSH with username to a VM ID\x1b[0m - $ sf nodes ssh huang@vm_xxxxxxxxxxxxxxxxxxxxx + $ sf nodes ssh root@vm_xxxxxxxxxxxxxxxxxxxxx `, ) .action(async (destination, options) => { diff --git a/src/lib/vm/list.ts b/src/lib/vm/list.ts index 7926adb..f0431be 100644 --- a/src/lib/vm/list.ts +++ b/src/lib/vm/list.ts @@ -144,7 +144,7 @@ You can use ${ console.log(table.toString()); console.log(`\n${gray("Use VM IDs to access and replace VMs.")}\n`); console.log(gray("Examples:")); - console.log(` sf vm ssh ${cyan(`USERNAME@${exampleId}`)}`); + console.log(` sf vm ssh ${cyan(`root@${exampleId}`)}`); console.log(` sf vm logs -i ${cyan(exampleId)} -f`); console.log(` sf vm replace -i ${cyan(exampleId)}`); }); diff --git a/src/lib/vm/ssh.ts b/src/lib/vm/ssh.ts index bc0fe3d..6f0d1fc 100644 --- a/src/lib/vm/ssh.ts +++ b/src/lib/vm/ssh.ts @@ -21,7 +21,7 @@ export function registerSsh(program: Command) { ) .argument( "", - "USERNAME@VM_ID The (optional) username, and VM id to SSH into.", + "[user@]vm_id - The (optional) username, and VM id to SSH into.", ) .allowExcessArguments(false) .action(async (destination, options) => {