Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1090)

Unified Diff: node_modules/vulcanize/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/cli.js

Issue 800513006: Added vulcanize under third_party/npm_modules (Closed) Base URL: https://chromium.googlesource.com/infra/third_party/npm_modules.git@master
Patch Set: Created 6 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: node_modules/vulcanize/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/cli.js
diff --git a/node_modules/vulcanize/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/cli.js b/node_modules/vulcanize/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/cli.js
new file mode 100755
index 0000000000000000000000000000000000000000..e0956fcc729d8daa55462977ea59f075e7144606
--- /dev/null
+++ b/node_modules/vulcanize/node_modules/update-notifier/node_modules/chalk/node_modules/has-ansi/cli.js
@@ -0,0 +1,53 @@
+#!/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);
+}

Powered by Google App Engine
This is Rietveld 408576698