Use functions to wrap package managers and detect if the aikido commands are available

This commit is contained in:
Sander Declerck 2025-07-23 11:36:45 +02:00
parent ccce2279c9
commit ca5d3ecb2a
No known key found for this signature in database
4 changed files with 118 additions and 45 deletions

View file

@ -24,18 +24,22 @@ function teardown(tools) {
);
}
// Removes the line that sources the safe-chain fish initialization script (~/.safe-chain/scripts/init-fish.fish)
removeLinesMatchingPattern(
startupFile,
/^source\s+~\/\.safe-chain\/scripts\/init-fish\.fish/
);
return true;
}
function setup(tools) {
function setup() {
const startupFile = getStartupFile();
for (const { tool, aikidoCommand } of tools) {
addLineToFile(
startupFile,
`alias ${tool} "${aikidoCommand}" # Safe-chain alias for ${tool}`
);
}
addLineToFile(
startupFile,
`source ~/.safe-chain/scripts/init-fish.fish # Safe-chain Fish initialization script`
);
return true;
}