mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Move safe-chain package to packages/safe-chain
This commit is contained in:
parent
fc9a9ca129
commit
7673d32912
68 changed files with 85 additions and 52 deletions
26
packages/safe-chain/src/shell-integration/shellDetection.js
Normal file
26
packages/safe-chain/src/shell-integration/shellDetection.js
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
import zsh from "./supported-shells/zsh.js";
|
||||
import bash from "./supported-shells/bash.js";
|
||||
import powershell from "./supported-shells/powershell.js";
|
||||
import windowsPowershell from "./supported-shells/windowsPowershell.js";
|
||||
import fish from "./supported-shells/fish.js";
|
||||
import { ui } from "../environment/userInteraction.js";
|
||||
|
||||
export function detectShells() {
|
||||
let possibleShells = [zsh, bash, powershell, windowsPowershell, fish];
|
||||
let availableShells = [];
|
||||
|
||||
try {
|
||||
for (const shell of possibleShells) {
|
||||
if (shell.isInstalled()) {
|
||||
availableShells.push(shell);
|
||||
}
|
||||
}
|
||||
} catch (error) {
|
||||
ui.writeError(
|
||||
`We were not able to detect which shells are installed on your system. Please check your shell configuration. Error: ${error.message}`
|
||||
);
|
||||
return [];
|
||||
}
|
||||
|
||||
return availableShells;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue