Sha256: 1a79dca961133c7c958314569705cdd246a0f9da951ecde9cc512313825cffec

Contents?: true

Size: 866 Bytes

Versions: 32

Compression:

Stored size: 866 Bytes

Contents

#!/usr/bin/env node
'use strict';
var pkg = require('./package.json');
var hasAnsi = require('./');
var input = process.argv[2];

function stdin(cb) {
	var ret = '';
	process.stdin.setEncoding('utf8');
	process.stdin.on('data', function (data) {
		ret += data;
	});
	process.stdin.on('end', function () {
		cb(ret);
	});
}

function help() {
	console.log([
		pkg.description,
		'',
		'Usage',
		'  $ has-ansi <string>',
		'  $ echo <string> | has-ansi',
		'',
		'Exits with code 0 if input has ANSI escape codes and 1 if not'
	].join('\n'));
}

function init(data) {
	process.exit(hasAnsi(data) ? 0 : 1);
}

if (process.argv.indexOf('--help') !== -1) {
	help();
	return;
}

if (process.argv.indexOf('--version') !== -1) {
	console.log(pkg.version);
	return;
}

if (process.stdin.isTTY) {
	if (!input) {
		help();
		return;
	}

	init(input);
} else {
	stdin(init);
}

Version data entries

32 entries across 14 versions & 4 rubygems

Version Path
gulp_assets-1.0.0.pre.5 template/node_modules/gulp-rev-replace/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js
gulp_assets-1.0.0.pre.5 template/node_modules/gulp-livereload/node_modules/chalk/node_modules/has-ansi/cli.js
gulp_assets-1.0.0.pre.4 template/node_modules/gulp-rev-replace/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js
gulp_assets-1.0.0.pre.4 template/node_modules/gulp-livereload/node_modules/chalk/node_modules/has-ansi/cli.js
gulp_assets-1.0.0.pre.3 template/node_modules/gulp-livereload/node_modules/chalk/node_modules/has-ansi/cli.js
gulp_assets-1.0.0.pre.3 template/node_modules/gulp-rev-replace/node_modules/gulp-util/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.16 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.16 spec/dummy/public/node_modules/bower/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.15 spec/dummy/public/node_modules/bower/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.14 spec/dummy/public/node_modules/bower/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.13 spec/dummy/public/node_modules/bower/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.12 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.11 spec/dummy/public/node_modules/bower/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/insight/node_modules/chalk/node_modules/has-ansi/cli.js
entangled-0.0.10 spec/dummy/public/node_modules/bower/node_modules/chalk/node_modules/has-ansi/cli.js