has-ansi
Advanced tools
Comparing version 0.1.0 to 1.0.0
30
cli.js
#!/usr/bin/env node | ||
'use strict'; | ||
var stdin = require('get-stdin'); | ||
var pkg = require('./package.json'); | ||
var hasAnsi = require('./'); | ||
var input = process.argv[2]; | ||
var argv = process.argv.slice(2); | ||
var input = argv[0]; | ||
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', | ||
' ' + pkg.description, | ||
'', | ||
'Exits with code 0 if input has ANSI escape codes and 1 if not' | ||
' Usage', | ||
' has-ansi <string>', | ||
' echo <string> | has-ansi', | ||
'', | ||
' Exits with code 0 if input has ANSI escape codes and 1 if not' | ||
].join('\n')); | ||
@@ -34,3 +26,3 @@ } | ||
if (process.argv.indexOf('--help') !== -1) { | ||
if (argv.indexOf('--help') !== -1) { | ||
help(); | ||
@@ -40,3 +32,3 @@ return; | ||
if (process.argv.indexOf('--version') !== -1) { | ||
if (argv.indexOf('--version') !== -1) { | ||
console.log(pkg.version); | ||
@@ -43,0 +35,0 @@ return; |
{ | ||
"name": "has-ansi", | ||
"version": "0.1.0", | ||
"version": "1.0.0", | ||
"description": "Check if a string has ANSI escape codes", | ||
"license": "MIT", | ||
"repository": "sindresorhus/has-ansi", | ||
"bin": { | ||
"has-ansi": "cli.js" | ||
}, | ||
"author": { | ||
@@ -15,2 +12,5 @@ "name": "Sindre Sorhus", | ||
}, | ||
"bin": { | ||
"has-ansi": "cli.js" | ||
}, | ||
"engines": { | ||
@@ -53,3 +53,4 @@ "node": ">=0.10.0" | ||
"dependencies": { | ||
"ansi-regex": "^0.2.0" | ||
"ansi-regex": "^1.0.0", | ||
"get-stdin": "^1.0.0" | ||
}, | ||
@@ -56,0 +57,0 @@ "devDependencies": { |
@@ -35,7 +35,7 @@ # has-ansi [![Build Status](https://travis-ci.org/sindresorhus/has-ansi.svg?branch=master)](https://travis-ci.org/sindresorhus/has-ansi) | ||
Usage | ||
$ has-ansi <string> | ||
$ echo <string> | has-ansi | ||
Usage | ||
has-ansi <string> | ||
echo <string> | has-ansi | ||
Exits with code 0 if input has ANSI escape codes and 1 if not | ||
Exits with code 0 if input has ANSI escape codes and 1 if not | ||
``` | ||
@@ -42,0 +42,0 @@ |
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
Found 1 instance in 1 package
0
2490
2
43
+ Addedget-stdin@^1.0.0
+ Addedansi-regex@1.1.1(transitive)
+ Addedget-stdin@1.0.0(transitive)
- Removedansi-regex@0.2.1(transitive)
Updatedansi-regex@^1.0.0