pi-ssh-remote 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -2
- package/README.zh-CN.md +1 -2
- package/index.ts +6 -5
- package/package.json +1 -1
package/README.md
CHANGED
package/README.zh-CN.md
CHANGED
package/index.ts
CHANGED
|
@@ -542,7 +542,7 @@ export default function sshRemoteExtension(pi: ExtensionAPI) {
|
|
|
542
542
|
if (remote) return remote;
|
|
543
543
|
if (credentialCache.resume) return reconnectRemote();
|
|
544
544
|
const command = lastCommand || activeSshCommand();
|
|
545
|
-
if (!command) throw new Error("No SSH endpoint configured; use /remote
|
|
545
|
+
if (!command) throw new Error("No SSH endpoint configured; use /remote ssh USER@HOST -p PORT");
|
|
546
546
|
const state = await connectInteractive(command, ctx, configuredCwd(command));
|
|
547
547
|
if (!state) throw new Error("SSH remote connection was cancelled or failed");
|
|
548
548
|
return state;
|
|
@@ -735,7 +735,7 @@ export default function sshRemoteExtension(pi: ExtensionAPI) {
|
|
|
735
735
|
});
|
|
736
736
|
|
|
737
737
|
pi.registerCommand("remote", {
|
|
738
|
-
description: "Connect over SSH and manage endpoints: /remote |
|
|
738
|
+
description: "Connect over SSH and manage endpoints: /remote | ssh USER@HOST [-p PORT] | config | use USER@HOST:PORT | config cwd PATH | forward [MAPPINGS] | unforward | exec COMMAND | cd PATH | status | reload | off | forget",
|
|
739
739
|
handler: async (args, ctx) => {
|
|
740
740
|
const input = args.trim().replace(/^\/?remote(?:\s+|$)/i, "").trim();
|
|
741
741
|
const action = input.toLowerCase();
|
|
@@ -748,13 +748,14 @@ export default function sshRemoteExtension(pi: ExtensionAPI) {
|
|
|
748
748
|
ctx.ui.notify(`SSH remote configuration: ${REMOTE_CONFIG_FILE}\n${rows.join("\n") || "No saved endpoints"}`, "info");
|
|
749
749
|
return;
|
|
750
750
|
}
|
|
751
|
-
if (/^
|
|
752
|
-
const
|
|
751
|
+
if (/^ssh\s+/i.test(input)) {
|
|
752
|
+
const sshArguments = input.replace(/^ssh\s+/i, "").trim();
|
|
753
|
+
const command = `ssh ${sshArguments}`;
|
|
753
754
|
try { parseSshCommand(command); }
|
|
754
755
|
catch (error) { ctx.ui.notify((error as Error).message, "error"); return; }
|
|
755
756
|
saveEndpointConfig(command, {}, true);
|
|
756
757
|
lastCommand = command;
|
|
757
|
-
|
|
758
|
+
await connectInteractive(command, ctx);
|
|
758
759
|
return;
|
|
759
760
|
}
|
|
760
761
|
if (/^(?:config\s+)?use\s+/i.test(input)) {
|