MCPcopy Create free account
hub / github.com/api3dao/airnode / execCommand

Function execCommand

packages/airnode-admin/test/e2e/cli.feature.ts:42–61  ·  view source on GitHub ↗
(command: string, ...args: CommandArg[])

Source from the content-addressed store, hash-verified

40
41 type CommandArg = [string, string | string[] | number | boolean];
42 const execCommand = (command: string, ...args: CommandArg[]) => {
43 const quote = (val: string) => `"${val}"`;
44 const formattedArgs = args
45 .map(([c, a]) => {
46 // if args is array then quote each elem and separate them with space
47 if (Array.isArray(a)) return `${c} ${a.map(quote).join(' ')}`;
48 // otherwise just quote each elem and separate them with space
49 else return `${c} ${quote(String(a))}`;
50 })
51 .join(' ');
52 const formattedCommand = `${command} ${formattedArgs}`;
53 if (DEBUG_COMMANDS) logger.log(`Executing command: ${formattedCommand}`);
54
55 const goExecSync = goSync(() => execSync(`node ${CLI_EXECUTABLE} ${formattedCommand}`).toString().trim());
56 if (!goExecSync.success) {
57 // rethrow the output of the CLI
58 throw new Error((goExecSync.error as any).reason.stdout.toString().trim());
59 }
60 return goExecSync.data;
61 };
62
63 const deriveSponsorWallet = (airnodeMnemonic: string, sponsorAddress: string): ethers.Wallet => {
64 return ethers.Wallet.fromMnemonic(

Callers 4

cli.feature.tsFile · 0.85
getSponsorStatusFunction · 0.85
createTemplateFunction · 0.85
checkWithdrawalStatusFunction · 0.85

Calls 1

quoteFunction · 0.85

Tested by

no test coverage detected