How to use the ansi-escapes.iTerm function in ansi-escapes

To help you get started, we’ve selected a few ansi-escapes 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 gucong3000 / gulp-reporter / lib / formatter.js View on Github external
Math.max(
				31 + lineNumberWidth + columnNumberWidth + maxMessageWidth + maxPluginNameWidth + maxRuleNameWidth,
				options.blame ? 66 + maxNameWidth + maxEmailWidth : 0
			)
		),
		source: options.blame,
	};

	errors = errors.map(error => (
		formatError(error, fmtOpts).replace(/^/gm, '    ')
	));

	let head = chalk.cyan.underline(path.relative(file.cwd, file.path).replace(/\\/g, '/'));
	if (process.stdout.isTTY && !isCI) {
		// make relative paths Cmd+click'able in iTerm
		head = ansiEscapes.iTerm.setCwd(file.cwd) + head;
	}
	errors.unshift(head);
	return errors.join('\n');
}
github jasancheg / sails-eslint / pretty-formatter.js View on Github external
line: line,
        lineWidth: lineWidth,
        column: column,
        columnWidth: columnWidth,
        message: msg,
        messageWidth: messageWidth,
        ruleId: x.ruleId || ''
      });
    });
  });

  var output = '\n';

  if(process.stdout.isTTY && !process.env.CI) {
    // make relative paths Cmd+click'able in iTerm
    output += ansiEscapes.iTerm.setCwd();
  }

  output += lines.map(function(x) {
    if(x.type === 'header') {
      // add the line number so it's Cmd+click'able in some terminals
      // use dim & gray for terminals like iTerm that doesn't support `hidden`
      return '  ' + chalk.underline(x.relativeFilePath + chalk.hidden.dim.gray(':' + x.firstLineCol));
    }

    if(x.type === 'message') {
      return [
        '',
        x.severity === 'warning' ? logSymbols.warning : logSymbols.error,
        repeating(maxLineWidth - x.lineWidth) + chalk.dim(x.line + chalk.gray(':') + x.column),
        repeating(maxColumnWidth - x.columnWidth) + x.message,
        repeating(maxMessageWidth - x.messageWidth) + chalk.gray.dim(x.ruleId)
github Dreamseer / stylelint-formatter-pretty / index.js View on Github external
ruleId: x.rule || ''
            });
          });
      });

    deprecations = cleanUpAdditionals(deprecations);
    deprecationsCount = deprecations.length;

    invalidOptionWarnings = cleanUpAdditionals(invalidOptionWarnings);
    invalidOptionWarningsCount = invalidOptionWarnings.length;

    let output = '\n';

    if (process.stdout.isTTY && !process.env.CI) {
      // Make relative paths Cmd+click'able in iTerm
      output += ansiEscapes.iTerm.setCwd();
    }

    output += lines.map(x => {
      if (x.type === 'header') {
        // Add the line number so it's Cmd+click'able in some terminals
        // Use dim & gray for terminals like iTerm that doesn't support `hidden`
        const position = showLineNumbers ? chalk.hidden.dim.gray(`:${x.firstLineCol}`) : '';

        return '  ' + chalk.underline(x.relativeFilePath + position);
      }

      if (x.type === 'message') {
        const line = [
          '',
          x.severity === 'warning' ? logSymbols.warning : logSymbols.error,
          ' '.repeat(maxLineWidth - x.lineWidth) + chalk.dim(x.line + chalk.gray(':') + x.column),
github sindresorhus / eslint-formatter-pretty / index.js View on Github external
line,
						lineWidth,
						column,
						columnWidth,
						message,
						messageWidth,
						ruleId: x.ruleId || ''
					});
				});
		});

	let output = '\n';

	if (process.stdout.isTTY && !process.env.CI) {
		// Make relative paths Command-clickable in iTerm
		output += ansiEscapes.iTerm.setCwd();
	}

	output += lines.map(x => {
		if (x.type === 'header') {
			// Add the line number so it's Command-click'able in some terminals
			// Use dim & gray for terminals like iTerm that doesn't support `hidden`
			const position = showLineNumbers ? chalk.hidden.dim.gray(`:${x.firstLineCol}`) : '';

			return '  ' + chalk.underline(x.relativeFilePath) + position;
		}

		if (x.type === 'message') {
			let ruleUrl;

			try {
				ruleUrl = data.rulesMeta[x.ruleId].docs.url;