How to use the @absolunet/terminal.terminal.exit function in @absolunet/terminal

To help you get started, we’ve selected a few @absolunet/terminal examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github absolunet / nwayo / packages / cli / helpers / util.js View on Github external
exit(message) {
		if (message && !argv['completion-logic']) {
			const { terminal } = require('@absolunet/terminal');
			terminal.exit(message);
		} else {
			process.exit();  // eslint-disable-line no-process-exit, unicorn/no-process-exit
		}
	}
github absolunet / nwayo / packages / workflow / helpers / env.js View on Github external
if (scopedMatch !== null) {
				normalizedName = `${scopedMatch[1]}${prefix}${scopedMatch[2]}`;
			} else {
				const namedMatch = (/^[a-z0-9-]+$/u).exec(name);
				if (namedMatch !== null) {
					normalizedName = `${prefix}${name}`;
				} else {
					normalizedName = name;
				}
			}

			let extension;
			try {
				extension = require(normalizedName);  // eslint-disable-line global-require
			} catch (error) {
				terminal.exit(`Extension '${name}' not found`);
			}

			extension.init({ options: CONFIG.extensions[name].options });

			enabled[extension.id] = extension;
		}
	});
github absolunet / nwayo / packages / workflow / classes / extension.js View on Github external
error(error) {
		terminal.error(`[nwayo-extension:${this.id} error]`);
		terminal.echo(error);
		terminal.exit();
	}
github absolunet / nwayo / packages / workflow / helpers / util.js View on Github external
runWorkflowTask(task, { bundle }) {
		let taskFile;
		let extension;
		const [, extensionName, taskName] = (/^(?[a-z-]+):(?[a-z-]+)$/u).exec(task) || [];

		if (extensionName) {
			extension = env.extensions[extensionName];

			if (!env.extensions[extensionName]) {
				terminal.exit(`Extension ${chalk.underline(extensionName)} is not enabled`);
			}

			if (!env.extensions[extensionName].taskExists(taskName)) {
				terminal.exit(`Task ${chalk.underline(task)} does not exists`);
			}

		} else {
			const [group]  = task.split('-');
			taskFile = `${paths.workflow.tasks}/${group}`;
			if (!fss.exists(`${taskFile}.js`)) {
				terminal.exit(`Task ${chalk.underline(task)} does not exists`);
			}
		}

		//-- Boost max listeners
		events.EventEmitter.prototype._maxListeners = 100;
github absolunet / nwayo / packages / workflow / helpers / toolbox.js View on Github external
return plumber((error) => {
			terminal.spacer(2);
			terminal.echo(`${emoji.get('monkey')}  ${error.toString()}`);
			terminal.exit();
		});
	}
github absolunet / nwayo / packages / workflow / helpers / env.js View on Github external
const subBundleData = fss.readYaml(subBundleFile);
						if (subBundleData.assets && subBundleData.assets.components) {
							data[name].assets.components = [...new Set([...data[name].assets.components, ...subBundleData.assets.components])];
						}

						if (subBundleData.scripts && subBundleData.scripts.collections) {
							Object.assign(data[name].scripts.collections, subBundleData.scripts.collections);
						}

						if (subBundleData.styles && subBundleData.styles.collections) {
							Object.assign(data[name].styles.collections, subBundleData.styles.collections);
						}
					}

				} else if (requiredSubname !== '*') {
					terminal.exit(`Bundle ${chalk.underline(bundle)} does not exists`);
				}
			}
		} else {
			terminal.exit(`${requiredName !== '*' ? `Bundle ${chalk.underline(bundle)} does not exists` : `No bundle found`}`);
		}

		__.bundles = data;
		__.bundlesComponents = uniq(flatten(map(__.bundles, property('assets.components'))));
	}
github absolunet / nwayo / packages / workflow / helpers / util.js View on Github external
terminal.echo(boxen(
				`Workflow update available ${chalk.dim(installedVersion)} ${chalk.reset('→')} ${chalk.green(requiredVersion)}

The required version in your project's package.json
is greater than the installed one

Run ${chalk.cyan('nwayo install workflow')} to update`,
				{
					padding:     1,
					margin:      0.5,
					align:       'center',
					borderColor: 'yellow'
				}
			));

			terminal.exit();
		}
	}
github absolunet / nwayo / packages / workflow / classes / task.js View on Github external
cli(meowCli) {
		if (__(this).get('deprecated')) {
			terminal.spacer();
			terminal.warning(`DEPRECATED - ${__(this).get('deprecated')}`);
			terminal.exit();
		}

		throw new Error('Not overwritten by subclass');
	}