UNPKG

alwaysai

Version:

The alwaysAI command-line interface (CLI)

38 lines 1.42 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.appExecCliLeaf = void 0; const alwayscli_1 = require("@alwaysai/alwayscli"); const app_1 = require("../../core/app"); exports.appExecCliLeaf = (0, alwayscli_1.CliLeaf)({ name: 'exec', description: 'Run a command in the target directory', namedInputs: { superuser: (0, alwayscli_1.CliFlagInput)({ description: 'Run the command as superuser "root"' }), 'no-container': (0, alwayscli_1.CliFlagInput)({ description: 'Run the command directly on the target host, not in a container' }) }, positionalInput: (0, alwayscli_1.CliStringArrayInput)({ placeholder: '<command> [<args>]', required: true }), async action([exe, ...args], opts) { const targetJsonFile = (0, app_1.TargetJsonFile)(); if (opts['no-container']) { if (opts.superuser) { throw new alwayscli_1.CliTerseError('--superuser is not yet supported with --no-container'); } targetJsonFile .readHostSpawner() .runForegroundSync({ exe, args, cwd: '.' }); } else { targetJsonFile .readContainerSpawner() .runForegroundSync({ exe, args, cwd: '.', superuser: opts.superuser }); } } }); //# sourceMappingURL=exec.js.map