mirror of
https://github.com/AikidoSec/safe-chain.git
synced 2026-05-26 12:10:49 +00:00
Exit installation instead of prompting the user
This commit is contained in:
parent
0cb9562857
commit
2f1692e253
7 changed files with 297 additions and 13 deletions
33
packages/safe-chain/src/config/cliArguments.js
Normal file
33
packages/safe-chain/src/config/cliArguments.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
const state = {
|
||||
malwareAction: undefined,
|
||||
};
|
||||
|
||||
const SAFE_CHAIN_ARG_PREFIX = "--safe-chain-";
|
||||
|
||||
export function initializeCliArguments(args) {
|
||||
// Reset state on each call
|
||||
state.malwareAction = undefined;
|
||||
|
||||
const safeChainArgs = [];
|
||||
const remainingArgs = [];
|
||||
|
||||
for (const arg of args) {
|
||||
if (arg.startsWith(SAFE_CHAIN_ARG_PREFIX)) {
|
||||
safeChainArgs.push(arg);
|
||||
|
||||
if (arg.startsWith(SAFE_CHAIN_ARG_PREFIX + "malware-action=")) {
|
||||
state.malwareAction = arg.substring(
|
||||
(SAFE_CHAIN_ARG_PREFIX + "malware-action=").length
|
||||
);
|
||||
}
|
||||
} else {
|
||||
remainingArgs.push(arg);
|
||||
}
|
||||
}
|
||||
|
||||
return remainingArgs;
|
||||
}
|
||||
|
||||
export function getMalwareAction() {
|
||||
return state.malwareAction;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue