mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 20:20:49 +00:00
Always use \n line endings for bash, zsh and fish
This commit is contained in:
parent
846c62e4e0
commit
93c23ee39f
4 changed files with 42 additions and 15 deletions
|
|
@ -8,6 +8,7 @@ import { execSync } from "child_process";
|
|||
const shellName = "Zsh";
|
||||
const executableName = "zsh";
|
||||
const startupFileCommand = "echo ${ZDOTDIR:-$HOME}/.zshrc";
|
||||
const eol = "\n"; // When zsh runs on Windows (e.g., Git Bash or WSL), it expects LF line endings.
|
||||
|
||||
function isInstalled() {
|
||||
return doesExecutableExistOnSystem(executableName);
|
||||
|
|
@ -18,13 +19,18 @@ function teardown(tools) {
|
|||
|
||||
for (const { tool } of tools) {
|
||||
// Remove any existing alias for the tool
|
||||
removeLinesMatchingPattern(startupFile, new RegExp(`^alias\\s+${tool}=`));
|
||||
removeLinesMatchingPattern(
|
||||
startupFile,
|
||||
new RegExp(`^alias\\s+${tool}=`),
|
||||
eol
|
||||
);
|
||||
}
|
||||
|
||||
// Removes the line that sources the safe-chain zsh initialization script (~/.aikido/scripts/init-posix.sh)
|
||||
removeLinesMatchingPattern(
|
||||
startupFile,
|
||||
/^source\s+~\/\.safe-chain\/scripts\/init-posix\.sh/
|
||||
/^source\s+~\/\.safe-chain\/scripts\/init-posix\.sh/,
|
||||
eol
|
||||
);
|
||||
|
||||
return true;
|
||||
|
|
@ -35,7 +41,8 @@ function setup() {
|
|||
|
||||
addLineToFile(
|
||||
startupFile,
|
||||
`source ~/.safe-chain/scripts/init-posix.sh # Safe-chain Zsh initialization script`
|
||||
`source ~/.safe-chain/scripts/init-posix.sh # Safe-chain Zsh initialization script`,
|
||||
eol
|
||||
);
|
||||
|
||||
return true;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue