mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Merge pull request #321 from AikidoSec/remove-ultimate-commands
Remove ultimate commands (not ready yet)
This commit is contained in:
commit
1177d38087
1 changed files with 1 additions and 81 deletions
|
|
@ -16,14 +16,6 @@ import path from "path";
|
||||||
import { fileURLToPath } from "url";
|
import { fileURLToPath } from "url";
|
||||||
import fs from "fs";
|
import fs from "fs";
|
||||||
import { knownAikidoTools } from "../src/shell-integration/helpers.js";
|
import { knownAikidoTools } from "../src/shell-integration/helpers.js";
|
||||||
import {
|
|
||||||
installUltimate,
|
|
||||||
uninstallUltimate,
|
|
||||||
} from "../src/installation/installUltimate.js";
|
|
||||||
import {
|
|
||||||
printUltimateLogs,
|
|
||||||
troubleshootingExport,
|
|
||||||
} from "../src/ultimate/ultimateTroubleshooting.js";
|
|
||||||
|
|
||||||
/** @type {string} */
|
/** @type {string} */
|
||||||
// This checks the current file's dirname in a way that's compatible with:
|
// This checks the current file's dirname in a way that's compatible with:
|
||||||
|
|
@ -70,39 +62,6 @@ if (tool) {
|
||||||
process.exit(0);
|
process.exit(0);
|
||||||
} else if (command === "setup") {
|
} else if (command === "setup") {
|
||||||
setup();
|
setup();
|
||||||
} else if (command === "ultimate") {
|
|
||||||
const cliArgs = initializeCliArguments(process.argv.slice(2));
|
|
||||||
const subCommand = cliArgs[1];
|
|
||||||
if (subCommand === "uninstall") {
|
|
||||||
guardCliArgsMaxLenght(2, cliArgs, "safe-chain ultimate uninstall");
|
|
||||||
(async () => {
|
|
||||||
await uninstallUltimate();
|
|
||||||
})();
|
|
||||||
} else if (subCommand === "troubleshooting-logs") {
|
|
||||||
guardCliArgsMaxLenght(
|
|
||||||
2,
|
|
||||||
cliArgs,
|
|
||||||
"safe-chain ultimate troubleshooting-logs",
|
|
||||||
);
|
|
||||||
(async () => {
|
|
||||||
await printUltimateLogs();
|
|
||||||
})();
|
|
||||||
} else if (subCommand === "troubleshooting-export") {
|
|
||||||
guardCliArgsMaxLenght(
|
|
||||||
2,
|
|
||||||
cliArgs,
|
|
||||||
"safe-chain ultimate troubleshooting-export",
|
|
||||||
);
|
|
||||||
(async () => {
|
|
||||||
await troubleshootingExport();
|
|
||||||
})();
|
|
||||||
} else {
|
|
||||||
guardCliArgsMaxLenght(1, cliArgs, "safe-chain ultimate");
|
|
||||||
// Install command = when no subcommand is provided (safe-chain ultimate)
|
|
||||||
(async () => {
|
|
||||||
await installUltimate();
|
|
||||||
})();
|
|
||||||
}
|
|
||||||
} else if (command === "teardown") {
|
} else if (command === "teardown") {
|
||||||
teardown();
|
teardown();
|
||||||
teardownDirectories();
|
teardownDirectories();
|
||||||
|
|
@ -121,22 +80,6 @@ if (tool) {
|
||||||
process.exit(1);
|
process.exit(1);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* @param {Number} maxLength
|
|
||||||
* @param {String[]} args
|
|
||||||
* @param {String} command
|
|
||||||
*/
|
|
||||||
function guardCliArgsMaxLenght(maxLength, args, command) {
|
|
||||||
if (args.length > maxLength) {
|
|
||||||
ui.writeError(`Unexpected number of arguments for command ${command}.`);
|
|
||||||
ui.emptyLine();
|
|
||||||
|
|
||||||
writeHelp();
|
|
||||||
|
|
||||||
process.exit(1);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
function writeHelp() {
|
function writeHelp() {
|
||||||
ui.writeInformation(
|
ui.writeInformation(
|
||||||
chalk.bold("Usage: ") + chalk.cyan("safe-chain <command>"),
|
chalk.bold("Usage: ") + chalk.cyan("safe-chain <command>"),
|
||||||
|
|
@ -145,7 +88,7 @@ function writeHelp() {
|
||||||
ui.writeInformation(
|
ui.writeInformation(
|
||||||
`Available commands: ${chalk.cyan("setup")}, ${chalk.cyan(
|
`Available commands: ${chalk.cyan("setup")}, ${chalk.cyan(
|
||||||
"teardown",
|
"teardown",
|
||||||
)}, ${chalk.cyan("setup-ci")}, ${chalk.cyan("ultimate")}, ${chalk.cyan("help")}, ${chalk.cyan(
|
)}, ${chalk.cyan("setup-ci")}, ${chalk.cyan("help")}, ${chalk.cyan(
|
||||||
"--version",
|
"--version",
|
||||||
)}`,
|
)}`,
|
||||||
);
|
);
|
||||||
|
|
@ -171,29 +114,6 @@ function writeHelp() {
|
||||||
)}): Display the current version of safe-chain.`,
|
)}): Display the current version of safe-chain.`,
|
||||||
);
|
);
|
||||||
ui.emptyLine();
|
ui.emptyLine();
|
||||||
ui.writeInformation(chalk.bold("Ultimate commands:"));
|
|
||||||
ui.emptyLine();
|
|
||||||
ui.writeInformation(
|
|
||||||
`- ${chalk.cyan(
|
|
||||||
"safe-chain ultimate",
|
|
||||||
)}: Install the ultimate version of safe-chain, enabling protection for more eco-systems.`,
|
|
||||||
);
|
|
||||||
ui.writeInformation(
|
|
||||||
`- ${chalk.cyan(
|
|
||||||
"safe-chain ultimate troubleshooting-logs",
|
|
||||||
)}: Prints standard and error logs for safe-chain ultimate and it's proxy.`,
|
|
||||||
);
|
|
||||||
ui.writeInformation(
|
|
||||||
`- ${chalk.cyan(
|
|
||||||
"safe-chain ultimate troubleshooting-export",
|
|
||||||
)}: Creates a zip archive of useful data for troubleshooting safe-chain ultimate, that can be shared with our support team.`,
|
|
||||||
);
|
|
||||||
ui.writeInformation(
|
|
||||||
`- ${chalk.cyan(
|
|
||||||
"safe-chain ultimate uninstall",
|
|
||||||
)}: Uninstall the ultimate version of safe-chain.`,
|
|
||||||
);
|
|
||||||
ui.emptyLine();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async function getVersion() {
|
async function getVersion() {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue