mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Undo move of files to safe-chain
This commit is contained in:
parent
b29bc2e6dc
commit
8fe228c476
68 changed files with 7 additions and 10 deletions
57
bin/safe-chain.js
Executable file
57
bin/safe-chain.js
Executable file
|
|
@ -0,0 +1,57 @@
|
|||
#!/usr/bin/env node
|
||||
|
||||
import chalk from "chalk";
|
||||
import { ui } from "../src/environment/userInteraction.js";
|
||||
import { setup } from "../src/shell-integration/setup.js";
|
||||
import { teardown } from "../src/shell-integration/teardown.js";
|
||||
|
||||
if (process.argv.length < 3) {
|
||||
ui.writeError("No command provided. Please provide a command to execute.");
|
||||
ui.emptyLine();
|
||||
writeHelp();
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
const command = process.argv[2];
|
||||
|
||||
if (command === "help" || command === "--help" || command === "-h") {
|
||||
writeHelp();
|
||||
process.exit(0);
|
||||
}
|
||||
|
||||
if (command === "setup") {
|
||||
setup();
|
||||
} else if (command === "teardown") {
|
||||
teardown();
|
||||
} else {
|
||||
ui.writeError(`Unknown command: ${command}.`);
|
||||
ui.emptyLine();
|
||||
|
||||
writeHelp();
|
||||
|
||||
process.exit(1);
|
||||
}
|
||||
|
||||
function writeHelp() {
|
||||
ui.writeInformation(
|
||||
chalk.bold("Usage: ") + chalk.cyan("safe-chain <command>")
|
||||
);
|
||||
ui.emptyLine();
|
||||
ui.writeInformation(
|
||||
`Available commands: ${chalk.cyan("setup")}, ${chalk.cyan(
|
||||
"teardown"
|
||||
)}, ${chalk.cyan("help")}`
|
||||
);
|
||||
ui.emptyLine();
|
||||
ui.writeInformation(
|
||||
`- ${chalk.cyan(
|
||||
"safe-chain setup"
|
||||
)}: This will setup your shell to wrap safe-chain around npm, npx and yarn.`
|
||||
);
|
||||
ui.writeInformation(
|
||||
`- ${chalk.cyan(
|
||||
"safe-chain teardown"
|
||||
)}: This will remove safe-chain aliases from your shell configuration.`
|
||||
);
|
||||
ui.emptyLine();
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue