mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Merge pull request #353 from AikidoSec/manual-setup-teardown-instructions
Add manual setup and teardown instructions on failure
This commit is contained in:
commit
745a831d55
8 changed files with 106 additions and 4 deletions
|
|
@ -91,9 +91,7 @@ async function setupShell(shell) {
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
ui.writeError(
|
ui.writeError(
|
||||||
`${chalk.bold("- " + shell.name + ":")} ${chalk.red(
|
`${chalk.bold("- " + shell.name + ":")} ${chalk.red("Setup failed")}`,
|
||||||
"Setup failed",
|
|
||||||
)}. Please check your ${shell.name} configuration.`,
|
|
||||||
);
|
);
|
||||||
if (error) {
|
if (error) {
|
||||||
let message = ` Error: ${error.message}`;
|
let message = ` Error: ${error.message}`;
|
||||||
|
|
@ -102,6 +100,12 @@ async function setupShell(shell) {
|
||||||
}
|
}
|
||||||
ui.writeError(message);
|
ui.writeError(message);
|
||||||
}
|
}
|
||||||
|
ui.emptyLine();
|
||||||
|
ui.writeInformation(` ${chalk.bold("To set up manually:")}`);
|
||||||
|
for (const instruction of shell.getManualSetupInstructions()) {
|
||||||
|
ui.writeInformation(` ${instruction}`);
|
||||||
|
}
|
||||||
|
ui.emptyLine();
|
||||||
}
|
}
|
||||||
|
|
||||||
return success;
|
return success;
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ import { ui } from "../environment/userInteraction.js";
|
||||||
* @property {() => boolean} isInstalled
|
* @property {() => boolean} isInstalled
|
||||||
* @property {(tools: import("./helpers.js").AikidoTool[]) => boolean|Promise<boolean>} setup
|
* @property {(tools: import("./helpers.js").AikidoTool[]) => boolean|Promise<boolean>} setup
|
||||||
* @property {(tools: import("./helpers.js").AikidoTool[]) => boolean} teardown
|
* @property {(tools: import("./helpers.js").AikidoTool[]) => boolean} teardown
|
||||||
|
* @property {() => string[]} getManualSetupInstructions
|
||||||
|
* @property {() => string[]} getManualTeardownInstructions
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
|
|
@ -123,6 +123,22 @@ function cygpathw(path) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getManualTeardownInstructions() {
|
||||||
|
return [
|
||||||
|
`Remove the following line from your ~/.bashrc file:`,
|
||||||
|
` source ~/.safe-chain/scripts/init-posix.sh`,
|
||||||
|
`Then restart your terminal or run: source ~/.bashrc`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getManualSetupInstructions() {
|
||||||
|
return [
|
||||||
|
`Add the following line to your ~/.bashrc file:`,
|
||||||
|
` source ~/.safe-chain/scripts/init-posix.sh`,
|
||||||
|
`Then restart your terminal or run: source ~/.bashrc`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import("../shellDetection.js").Shell}
|
* @type {import("../shellDetection.js").Shell}
|
||||||
*/
|
*/
|
||||||
|
|
@ -131,4 +147,6 @@ export default {
|
||||||
isInstalled,
|
isInstalled,
|
||||||
setup,
|
setup,
|
||||||
teardown,
|
teardown,
|
||||||
|
getManualSetupInstructions,
|
||||||
|
getManualTeardownInstructions,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -66,6 +66,22 @@ function getStartupFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getManualTeardownInstructions() {
|
||||||
|
return [
|
||||||
|
`Remove the following line from your ~/.config/fish/config.fish file:`,
|
||||||
|
` source ~/.safe-chain/scripts/init-fish.fish`,
|
||||||
|
`Then restart your terminal or run: source ~/.config/fish/config.fish`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getManualSetupInstructions() {
|
||||||
|
return [
|
||||||
|
`Add the following line to your ~/.config/fish/config.fish file:`,
|
||||||
|
` source ~/.safe-chain/scripts/init-fish.fish`,
|
||||||
|
`Then restart your terminal or run: source ~/.config/fish/config.fish`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import("../shellDetection.js").Shell}
|
* @type {import("../shellDetection.js").Shell}
|
||||||
*/
|
*/
|
||||||
|
|
@ -74,4 +90,6 @@ export default {
|
||||||
isInstalled,
|
isInstalled,
|
||||||
setup,
|
setup,
|
||||||
teardown,
|
teardown,
|
||||||
|
getManualSetupInstructions,
|
||||||
|
getManualTeardownInstructions,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,22 @@ function getStartupFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getManualTeardownInstructions() {
|
||||||
|
return [
|
||||||
|
`Remove the following line from your PowerShell profile (run "echo $PROFILE" to find its location):`,
|
||||||
|
` . "$HOME\\.safe-chain\\scripts\\init-pwsh.ps1"`,
|
||||||
|
`Then restart your terminal or run: . $PROFILE`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getManualSetupInstructions() {
|
||||||
|
return [
|
||||||
|
`Add the following line to your PowerShell profile (run "echo $PROFILE" to find its location):`,
|
||||||
|
` . "$HOME\\.safe-chain\\scripts\\init-pwsh.ps1"`,
|
||||||
|
`Then restart your terminal or run: . $PROFILE`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import("../shellDetection.js").Shell}
|
* @type {import("../shellDetection.js").Shell}
|
||||||
*/
|
*/
|
||||||
|
|
@ -79,4 +95,6 @@ export default {
|
||||||
isInstalled,
|
isInstalled,
|
||||||
setup,
|
setup,
|
||||||
teardown,
|
teardown,
|
||||||
|
getManualSetupInstructions,
|
||||||
|
getManualTeardownInstructions,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -71,6 +71,22 @@ function getStartupFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getManualTeardownInstructions() {
|
||||||
|
return [
|
||||||
|
`Remove the following line from your PowerShell profile (run "echo $PROFILE" to find its location):`,
|
||||||
|
` . "$HOME\\.safe-chain\\scripts\\init-pwsh.ps1"`,
|
||||||
|
`Then restart your terminal or run: . $PROFILE`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getManualSetupInstructions() {
|
||||||
|
return [
|
||||||
|
`Add the following line to your PowerShell profile (run "echo $PROFILE" to find its location):`,
|
||||||
|
` . "$HOME\\.safe-chain\\scripts\\init-pwsh.ps1"`,
|
||||||
|
`Then restart your terminal or run: . $PROFILE`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {import("../shellDetection.js").Shell}
|
* @type {import("../shellDetection.js").Shell}
|
||||||
*/
|
*/
|
||||||
|
|
@ -79,4 +95,6 @@ export default {
|
||||||
isInstalled,
|
isInstalled,
|
||||||
setup,
|
setup,
|
||||||
teardown,
|
teardown,
|
||||||
|
getManualSetupInstructions,
|
||||||
|
getManualTeardownInstructions,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -66,9 +66,27 @@ function getStartupFile() {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function getManualTeardownInstructions() {
|
||||||
|
return [
|
||||||
|
`Remove the following line from your ~/.zshrc file:`,
|
||||||
|
` source ~/.safe-chain/scripts/init-posix.sh`,
|
||||||
|
`Then restart your terminal or run: source ~/.zshrc`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
function getManualSetupInstructions() {
|
||||||
|
return [
|
||||||
|
`Add the following line to your ~/.zshrc file:`,
|
||||||
|
` source ~/.safe-chain/scripts/init-posix.sh`,
|
||||||
|
`Then restart your terminal or run: source ~/.zshrc`,
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
export default {
|
export default {
|
||||||
name: shellName,
|
name: shellName,
|
||||||
isInstalled,
|
isInstalled,
|
||||||
setup,
|
setup,
|
||||||
teardown,
|
teardown,
|
||||||
|
getManualSetupInstructions,
|
||||||
|
getManualTeardownInstructions,
|
||||||
};
|
};
|
||||||
|
|
|
||||||
|
|
@ -47,8 +47,14 @@ export async function teardown() {
|
||||||
ui.writeError(
|
ui.writeError(
|
||||||
`${chalk.bold("- " + shell.name + ":")} ${chalk.red(
|
`${chalk.bold("- " + shell.name + ":")} ${chalk.red(
|
||||||
"Teardown failed"
|
"Teardown failed"
|
||||||
)}. Please check your ${shell.name} configuration.`
|
)}`
|
||||||
);
|
);
|
||||||
|
ui.emptyLine();
|
||||||
|
ui.writeInformation(` ${chalk.bold("To tear down manually:")}`);
|
||||||
|
for (const instruction of shell.getManualTeardownInstructions()) {
|
||||||
|
ui.writeInformation(` ${instruction}`);
|
||||||
|
}
|
||||||
|
ui.emptyLine();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue