alwaysai
Version:
The alwaysAI command-line interface (CLI)
53 lines • 2.7 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const ora = require("ora");
const target_protocol_input_component_1 = require("./target-protocol-input-component");
const check_for_docker_component_1 = require("./check-for-docker-component");
const target_config_file_1 = require("../util/target-config-file");
const target_hostname_input_component_1 = require("./target-hostname-input-component");
const target_path_input_component_1 = require("./target-path-input-component");
const write_app_config_file_component_1 = require("./write-app-config-file-component");
const write_app_py_file_component_1 = require("./write-app-py-file-component");
const check_user_is_logged_in_component_1 = require("./check-user-is-logged-in-component");
async function appConfigureComponent(props) {
const { yes } = props;
await check_user_is_logged_in_component_1.checkUserIsLoggedInComponent({ yes });
await write_app_config_file_component_1.writeAppConfigFileComponent();
await write_app_py_file_component_1.writeAppPyFileComponent();
const targetProtocol = yes
? props.targetProtocol
: await target_protocol_input_component_1.targetProtocolPromptedInputComponent({
targetProtocol: props.targetProtocol,
});
switch (targetProtocol) {
case 'docker:':
await check_for_docker_component_1.checkForDockerComponent();
target_config_file_1.targetConfigFile.write({ protocol: targetProtocol });
ora(`Write ${target_config_file_1.TARGET_CONFIG_FILE_NAME}`).succeed();
break;
case 'ssh+docker:':
const targetHostname = yes
? props.targetHostname
: await target_hostname_input_component_1.targetHostnameInputComponent({
yes,
targetHostname: props.targetHostname,
});
await check_for_docker_component_1.checkForDockerComponent({ targetHostname });
const targetPath = await target_path_input_component_1.targetPathInputComponent({
yes,
targetHostname,
targetPath: props.targetPath,
});
target_config_file_1.targetConfigFile.write({
protocol: targetProtocol,
hostname: targetHostname,
path: targetPath,
});
ora(`Write ${target_config_file_1.TARGET_CONFIG_FILE_NAME}`).succeed();
break;
default:
throw new Error(`Unexpected target protocol ${targetProtocol}`);
}
}
exports.appConfigureComponent = appConfigureComponent;
//# sourceMappingURL=app-configure-component.js.map