How to use the @absolunet/terminal.terminal.echo 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 / workflow / helpers / util.js View on Github external
env.initWorkflow({ bundle });


		//-- Load tasks
		/* eslint-disable global-require */
		process.stdout.write(`\n${env.logo}  Gathering intel... `);

		const gulp = require('gulp');  // gulp.js is really heavy on load

		if (extension) {
			extension.requireTask(taskName);
		} else {
			require(taskFile)();
		}

		terminal.echo(chalk.green(`\r${env.logo}  Ready to roll  `));
		/* eslint-enable global-require */


		//-- Run task
		if (gulp.task(task)) {
			terminal.spacer();
			gulp.series(task)();
		} else {
			terminal.exit(`Task ${chalk.underline(task)} does not exists`);
		}
	}
github absolunet / nwayo / packages / workflow / helpers / util.js View on Github external
checkInstalledWorkflow() {

		// Check for asked version vs installed version
		const requiredVersion  = env.packageConfig.dependencies[env.packageName];
		const installedVersion = env.workflowConfig.version;

		if (semver.gt(requiredVersion, installedVersion)) {

			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 / 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 / flow.js View on Github external
const logGuard = (action, name, file) => {
	switch (action) {

		case START:
			return `${emoji.get('guardsman')}  Guard n°${__.totalGuards + 1} standing guard...`;

		case ALERT:
			return terminal.echo(`${emoji.get('mega')}  Guard n°${__.totalGuards} alerted by ${chalk.magenta(file.split(`${paths.directory.root}/`)[1])} calling ${chalk.cyan(name)}`);

		case END:
			return terminal.echo(`${emoji.get('zzz')}  Guard n°${__.activeGuards[name]} duty is completed ${chalk.cyan.dim(`(${name})`)}${
				__.ignoredChanges[name] ? chalk.yellow(`    ⚠ ${pluralize('change', __.ignoredChanges[name], true)} ${__.ignoredChanges[name] === 1 ? 'was' : 'were'} ignored`) : ''
			}\n`);

		default: return undefined;

	}
};
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 / cli / doctor.js View on Github external
//-- Reports
		reporter('General', general);
		reporter('Root strucure', root);
		reporter('Bundles', bundles);
		reporter('Components', components);
		reporter('Workflow', workflow);
		reporter('Vendors', vendors);
		reporter('Sync between workflow and toolbox', sync);


		//-- Totals
		terminal.spacer(2);

		if (totals.success) {
			terminal.echo(chalk.green(`${pluralize('test', totals.success, true)} passed`));
		}

		if (totals.failure) {
			terminal.echo(chalk.red(`${pluralize('test', totals.failure, true)} failed`));
		}

		terminal.spacer();


		//-- Reward
		if (totals.failure === 0) {
			const reward = fss.readFile(`${paths.workflow.ressources}/doctor-reward`, 'utf8');
			const pink   = chalk.hex('#ff69b4');
			const green  = chalk.hex('#198c19');

			terminal.echo(reward
github absolunet / nwayo / packages / workflow / cli / doctor.js View on Github external
reporter('Bundles', bundles);
		reporter('Components', components);
		reporter('Workflow', workflow);
		reporter('Vendors', vendors);
		reporter('Sync between workflow and toolbox', sync);


		//-- Totals
		terminal.spacer(2);

		if (totals.success) {
			terminal.echo(chalk.green(`${pluralize('test', totals.success, true)} passed`));
		}

		if (totals.failure) {
			terminal.echo(chalk.red(`${pluralize('test', totals.failure, true)} failed`));
		}

		terminal.spacer();


		//-- Reward
		if (totals.failure === 0) {
			const reward = fss.readFile(`${paths.workflow.ressources}/doctor-reward`, 'utf8');
			const pink   = chalk.hex('#ff69b4');
			const green  = chalk.hex('#198c19');

			terminal.echo(reward
				.replace(/_.--._/ug, `_${pink('.--.')}_`)
				.replace(/`--'/ug, pink('`--\''))
				.replace(/\(\)/ug, pink('()'))
				.replace(/.==./ug, green('.==.')))
github absolunet / nwayo / packages / workflow / cli / doctor.js View on Github external
const reporter = (title, reports) => {
	let success;

	const titleColor = reports.summary.success ? chalk.green : chalk.red;
	terminal.echo(`${chalk.cyan(title)} diagnosis  ${titleColor(`${reports.summary.success ? '(^_^)' : 'ಠ_ಠ'} ${reports.summary.nb ? ` [${reports.summary.nb.success}/${reports.summary.nb.total}]` : ''}`)}\n`);

	totals.success += reports.summary.nb.success;
	totals.failure += reports.summary.nb.failure;

	if (reports.summary.success && !verbose) {
		terminal.echoIndent(chalk.green(`${figures.tick}  ${reports.summary.nb.total === 1 ? reports.last.message : 'All tests passed'}`));
	} else {

		reports.list.forEach((test) => {
			if (test.success && verbose) {
				terminal.echoIndent(`${chalk.green(figures.tick)}  ${chalk.dim(test.message)}`);

			} else if (!test.success) {

				let extra = '';
				if (test.differences) {
github absolunet / nwayo / packages / workflow / cli / doctor.js View on Github external
}

		if (totals.failure) {
			terminal.echo(chalk.red(`${pluralize('test', totals.failure, true)} failed`));
		}

		terminal.spacer();


		//-- Reward
		if (totals.failure === 0) {
			const reward = fss.readFile(`${paths.workflow.ressources}/doctor-reward`, 'utf8');
			const pink   = chalk.hex('#ff69b4');
			const green  = chalk.hex('#198c19');

			terminal.echo(reward
				.replace(/_.--._/ug, `_${pink('.--.')}_`)
				.replace(/`--'/ug, pink('`--\''))
				.replace(/\(\)/ug, pink('()'))
				.replace(/.==./ug, green('.==.')))
			;
			terminal.spacer();
		}
	}