agent-ssh-cli 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 -0
- package/package.json +1 -1
- package/src/cli.js +14 -4
package/README.md
CHANGED
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
<a href="https://github.com/sleepinginsummer/agent-ssh-cli/blob/main/LICENSE"><img src="https://img.shields.io/badge/License-MIT-green" alt="License MIT"></a>
|
|
12
12
|
<a href="https://nodejs.org/"><img src="https://img.shields.io/badge/Node.js-%3E%3D18-339933?logo=node.js&logoColor=white" alt="Node.js >=18"></a>
|
|
13
13
|
<a href="https://www.npmjs.com/"><img src="https://img.shields.io/badge/npm-%3E%3D8-CB3837?logo=npm&logoColor=white" alt="npm >=8"></a>
|
|
14
|
+
<a href="https://github.com/sleepinginsummer/agent-ssh-cli"><img src="https://img.shields.io/badge/Windows-MacOS-0078D6?labelColor=0078D6&color=C0C0C0" alt="Windows/MacOS"></a>
|
|
14
15
|
<a href="https://github.com/sleepinginsummer/agent-ssh-cli/releases"><img src="https://img.shields.io/badge/release-v0.1.0-blue" alt="release v0.1.0"></a>
|
|
15
16
|
<a href="https://github.com/sleepinginsummer/agent-ssh-cli/pulls"><img src="https://img.shields.io/badge/PRs-welcome-brightgreen" alt="PRs welcome"></a>
|
|
16
17
|
</p>
|
package/package.json
CHANGED
package/src/cli.js
CHANGED
|
@@ -242,10 +242,20 @@ function parseExecuteArgs(argv) {
|
|
|
242
242
|
return parsed;
|
|
243
243
|
}
|
|
244
244
|
const args = [...parsed.args];
|
|
245
|
-
const
|
|
246
|
-
const
|
|
247
|
-
const
|
|
248
|
-
const
|
|
245
|
+
const connectionNameOption = takeOption(args, ["--connection", "-c"]);
|
|
246
|
+
const commandOption = takeOption(args, ["--command"]);
|
|
247
|
+
const directoryOption = takeOption(args, ["--directory", "-d"]);
|
|
248
|
+
const timeoutOption = takeOption(args, ["--timeout", "-t"]);
|
|
249
|
+
const connectionNamePositional = takePositional(args, "connectionName");
|
|
250
|
+
const commandPositional = takePositional(args, "command");
|
|
251
|
+
|
|
252
|
+
ensureNoMixedInput(connectionNameOption.present ? connectionNameOption.value : undefined, connectionNamePositional, "connectionName");
|
|
253
|
+
ensureNoMixedInput(commandOption.present ? commandOption.value : undefined, commandPositional, "command");
|
|
254
|
+
|
|
255
|
+
const connectionName = connectionNameOption.present ? connectionNameOption.value : connectionNamePositional;
|
|
256
|
+
const command = commandOption.present ? commandOption.value : commandPositional;
|
|
257
|
+
const directory = directoryOption.present ? directoryOption.value : undefined;
|
|
258
|
+
const timeoutValue = timeoutOption.present ? timeoutOption.value : undefined;
|
|
249
259
|
for (let index = 0; index < args.length; index += 1) {
|
|
250
260
|
if (args[index]?.startsWith("--")) {
|
|
251
261
|
throw new Error(`不支持的参数: ${args[index]}`);
|