@aptos-labs/aptos-cli 1.1.0 → 2.0.0
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 +117 -0
- package/dist/aptos.js +31 -0
- package/dist/aptos.js.map +1 -0
- package/dist/examples/examples.test.js +69 -0
- package/dist/examples/examples.test.js.map +1 -0
- package/dist/tasks/install.js +93 -0
- package/dist/tasks/install.js.map +1 -0
- package/dist/tasks/install.test.js +227 -0
- package/dist/tasks/install.test.js.map +1 -0
- package/dist/tasks/run.js +26 -0
- package/dist/tasks/run.js.map +1 -0
- package/dist/tasks/run.test.js +92 -0
- package/dist/tasks/run.test.js.map +1 -0
- package/dist/tasks/update.js +68 -0
- package/dist/tasks/update.js.map +1 -0
- package/dist/utils/brewOperations.js +34 -0
- package/dist/utils/brewOperations.js.map +1 -0
- package/dist/utils/brewOperations.test.js +83 -0
- package/dist/utils/brewOperations.test.js.map +1 -0
- package/dist/utils/consts.js +3 -0
- package/dist/utils/consts.js.map +1 -0
- package/dist/utils/execSyncShell.js +9 -0
- package/dist/utils/execSyncShell.js.map +1 -0
- package/dist/utils/executableIsAvailable.js +12 -0
- package/dist/utils/executableIsAvailable.js.map +1 -0
- package/dist/utils/getLocalBinPath.js +86 -0
- package/dist/utils/getLocalBinPath.js.map +1 -0
- package/dist/utils/getUserOs.js +101 -0
- package/dist/utils/getUserOs.js.map +1 -0
- package/dist/utils/getUserOs.test.js +143 -0
- package/dist/utils/getUserOs.test.js.map +1 -0
- package/dist/utils/ghOperations.js +87 -0
- package/dist/utils/ghOperations.js.map +1 -0
- package/dist/utils/ghOperations.test.js +217 -0
- package/dist/utils/ghOperations.test.js.map +1 -0
- package/dist/utils/parseCommandOptions.js +21 -0
- package/dist/utils/parseCommandOptions.js.map +1 -0
- package/dist/utils/windowsPackageManagers.js +100 -0
- package/dist/utils/windowsPackageManagers.js.map +1 -0
- package/dist/utils/windowsPackageManagers.test.js +169 -0
- package/dist/utils/windowsPackageManagers.test.js.map +1 -0
- package/package.json +22 -11
- package/bin/.gitkeep +0 -0
- package/bin/aptos.ts +0 -42
- package/bin/tasks/install.ts +0 -55
- package/bin/tasks/run.ts +0 -23
- package/bin/tasks/update.ts +0 -41
- package/bin/utils/aptosExecutableIsAvailable.ts +0 -14
- package/bin/utils/brewOperations.ts +0 -12
- package/bin/utils/consts.ts +0 -3
- package/bin/utils/execSyncShell.ts +0 -8
- package/bin/utils/getLocalBinPath.ts +0 -28
- package/bin/utils/getUserOs.ts +0 -18
- package/bin/utils/ghOperations.ts +0 -20
- package/bin/utils/handleHelpOptions.ts +0 -38
- package/bin/utils/parseCommandOptions.ts +0 -28
- package/bin/utils/versions.ts +0 -9
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
import { spawnSync } from "child_process";
|
|
2
|
-
import { Command } from "commander";
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Handle the `--help` option for the Aptos CLI. This function is used to combine
|
|
6
|
-
* the Aptos CLI help output with the Commander help output.
|
|
7
|
-
* @param program - The Commander program instance.
|
|
8
|
-
* @param unknownOptions - The unknown options passed to the CLI.
|
|
9
|
-
* @returns void
|
|
10
|
-
*/
|
|
11
|
-
export const handleHelpOptions = (
|
|
12
|
-
program: Command,
|
|
13
|
-
unknownOptions: string[]
|
|
14
|
-
) => {
|
|
15
|
-
// Capture the Aptos CLI help output
|
|
16
|
-
const cliHelp = spawnSync(`aptos`, unknownOptions, {
|
|
17
|
-
stdio: "pipe",
|
|
18
|
-
encoding: "utf-8",
|
|
19
|
-
});
|
|
20
|
-
// Generate Commander help text
|
|
21
|
-
const commanderHelp = program.helpInformation();
|
|
22
|
-
|
|
23
|
-
// Remove the "Usage" and "Options" lines from the Commander output
|
|
24
|
-
const commanderOptionsOnly = commanderHelp
|
|
25
|
-
.split("\n")
|
|
26
|
-
.filter((line) => !line.startsWith("Usage") && !line.startsWith("Options"))
|
|
27
|
-
.join("\n");
|
|
28
|
-
|
|
29
|
-
// Find where the CLI options start and append the Commander options to the existing CLI options
|
|
30
|
-
const combinedHelp = cliHelp.stdout.replace(
|
|
31
|
-
"Options:",
|
|
32
|
-
`Options:\n${commanderOptionsOnly.trim()}`
|
|
33
|
-
);
|
|
34
|
-
|
|
35
|
-
// Output the combined help
|
|
36
|
-
console.log(combinedHelp);
|
|
37
|
-
return;
|
|
38
|
-
};
|
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import { existsSync } from "fs";
|
|
2
|
-
import { installCli } from "../tasks/install.js";
|
|
3
|
-
import { runCLI } from "../tasks/run.js";
|
|
4
|
-
import { updateCli } from "../tasks/update.js";
|
|
5
|
-
import { getLocalBinPath } from "./getLocalBinPath.js";
|
|
6
|
-
|
|
7
|
-
export const parseCommandOptions = async (
|
|
8
|
-
options: { install: boolean; update: boolean },
|
|
9
|
-
unknownOptions: string[]
|
|
10
|
-
) => {
|
|
11
|
-
// if `--install` flag is set, only install the cli and dont run it
|
|
12
|
-
if (options.install) {
|
|
13
|
-
await installCli();
|
|
14
|
-
return;
|
|
15
|
-
}
|
|
16
|
-
// if `--update` flag is set, update the cli and dont run it
|
|
17
|
-
if (options.update) {
|
|
18
|
-
await updateCli();
|
|
19
|
-
return;
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
// if no flags are set, install and run the cli
|
|
23
|
-
const path = getLocalBinPath();
|
|
24
|
-
if (!existsSync(path)) {
|
|
25
|
-
await installCli();
|
|
26
|
-
}
|
|
27
|
-
await runCLI(unknownOptions);
|
|
28
|
-
};
|
package/bin/utils/versions.ts
DELETED