UNPKG

alwaysai

Version:

The alwaysAI command-line interface (CLI)

52 lines 2.4 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.appConfigureCliLeaf = void 0; const alwayscli_1 = require("@alwaysai/alwayscli"); const cli_inputs_1 = require("../../cli-inputs"); const app_1 = require("../../components/app"); const app_2 = require("../../core/app"); const environment_1 = require("../../environment"); const util_1 = require("../../util"); exports.appConfigureCliLeaf = (0, alwayscli_1.CliLeaf)({ name: 'configure', description: 'Configure this directory as an alwaysAI application', namedInputs: { yes: cli_inputs_1.yesCliInput, protocol: cli_inputs_1.targetProtocolCliInput, hardware: cli_inputs_1.targetHardwareCliInput, hostname: cli_inputs_1.targetHostnameCliInput, path: cli_inputs_1.targetPathCliInput, project: (0, alwayscli_1.CliStringInput)({ description: 'Project ID' }), deviceId: (0, alwayscli_1.CliStringInput)({ description: 'Project specific device' }), 'sync-models': (0, alwayscli_1.CliFlagInput)({ description: 'Pulls project models to local application' }) }, async action(_, { yes, protocol, hardware, hostname, path, project, deviceId, 'sync-models': syncModels }) { // Preliminary checks that don't help us with type narrowing if (protocol === 'docker:' && environment_1.ALWAYSAI_OS_PLATFORM !== 'linux') { throw new alwayscli_1.CliUsageError(`Option "protocol" is not allowed to have value "${app_2.TargetProtocol['docker:']}" if your operating system platform is "${environment_1.ALWAYSAI_OS_PLATFORM}"`); } if (protocol === 'docker:' && hostname) { throw new alwayscli_1.CliUsageError((0, util_1.NotAllowedWithMessage)('hostname', 'protocol', app_2.TargetProtocol['docker:'])); } if (protocol === 'docker:' && path) { throw new alwayscli_1.CliUsageError((0, util_1.NotAllowedWithMessage)('path', 'protocol', app_2.TargetProtocol['docker:'])); } return await (0, app_1.appConfigureComponent)({ yes, targetProtocol: protocol, targetHardware: hardware, targetHostname: hostname, targetPath: path, project, deviceId, syncModels }); } }); //# sourceMappingURL=configure.js.map