Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

ansi-escape-sequences

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

ansi-escape-sequences - npm Package Compare versions

Comparing version 2.0.0 to 2.1.0

38

bin/cli.js
#!/usr/bin/env node
"use strict";
var ansi = require("../");
var tr = require("transform-tools");
var name = process.argv[2];
var name2 = process.argv[3];
var arg1 = process.argv[4];
var arg2 = process.argv[5];
var seq = null;
process.argv.splice(0, 2);
if (!process.argv.length){
console.error(ansi.format("Usage", "underline"));
console.error("$ ansi <method> <args>");
console.error();
console.error(ansi.format("Example", "underline"));
console.error("$ echo yeah | ansi format underline");
process.exit(1);
}
var method = process.argv.shift();
var args = process.argv;
if (typeof ansi[name][name2] === "function"){
seq = ansi[name][name2](arg1, arg2);
} else {
seq = ansi[name][name2];
}
if (seq !== null) {
process.stdout.write(seq);
}
process.stdin
.pipe(tr.collect({
through: function(input){
if (method === "format"){
return ansi.format(input, args);
} else {
console.error(ansi.format("invalid method: " + method, "red"));
}
}
}))
.pipe(process.stdout);

@@ -8,3 +8,2 @@ "use strict";

/**
A simple library containing all known terminal [ansi escape codes and sequences](http://en.wikipedia.org/wiki/ANSI_escape_code). Useful for adding colour to your command-line output, or building a dynamic text user interface.
@exports ansi-escape-sequences

@@ -11,0 +10,0 @@ @typicalname ansi

{
"name": "ansi-escape-sequences",
"author": "Lloyd Brookes <75pound@gmail.com>",
"version": "2.0.0",
"version": "2.1.0",
"description": "A simple library containing all known terminal ansi escape codes and sequences. Useful for adding colour to your command-line output or building a dynamic text user interface.",

@@ -29,3 +29,4 @@ "repository": "https://github.com/75lb/ansi-escape-sequences.git",

"dependencies": {
"array-tools": "^1.4.1"
"array-tools": "^1.4.1",
"transform-tools": "~0.1.1"
},

@@ -32,0 +33,0 @@ "devDependencies": {

@@ -6,6 +6,13 @@ [![view on npm](http://img.shields.io/npm/v/ansi-escape-sequences.svg)](https://www.npmjs.org/package/ansi-escape-sequences)

<a name="module_ansi-escape-sequences"></a>
# ansi-escape-sequences
A simple library containing all known terminal [ansi escape codes and sequences](http://en.wikipedia.org/wiki/ANSI_escape_code). Useful for adding colour to your command-line output, or building a dynamic text user interface.
## Command-line usage
Format text in the terminal (bold red, in this case):
<pre><code>
$ echo yeah | ansi format bold red
<strong>yeah</strong>
</code></pre>
## API Reference
**Example**

@@ -230,4 +237,16 @@ ```js

## Install
As a library:
```
$ npm install ansi-escape-sequences --save
```
As a command-line tool:
```
$ npm install -g ansi-escape-sequences
```
* * *
&copy; 2015 Lloyd Brookes \<75pound@gmail.com\>. Documented by [jsdoc-to-markdown](https://github.com/jsdoc2md/jsdoc-to-markdown).

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc