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

terminal-kit

Package Overview
Dependencies
Maintainers
1
Versions
638
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

terminal-kit - npm Package Compare versions

Comparing version 0.1.11 to 0.1.12

57

documentation.md

@@ -12,6 +12,4 @@

Work in progress, only a rough documentation ATM.
# Features

@@ -34,8 +32,16 @@

```js
// Require the lib
var term = require( 'terminal-kit' ) ;
term( 'Hello world!\n' ) ; // output "Hello world!" normally
term.red( 'red' ) ; // output 'red' in red
term.bold( 'bold' ) ; // output 'bold' in bold
// output 'mixed' using bold, underlined red, exposing style-mixing syntax
// The term() function simply output a string to stdout, using current style
// output "Hello world!" in default terminal's colors
term( 'Hello world!\n' ) ;
// This output 'red' in red
term.red( 'red' ) ;
// This output 'bold' in bold
term.bold( 'bold' ) ;
// output 'mixed' using bold, underlined & red, exposing the style-mixing syntax
term.bold.underline.red( 'mixed' ) ;

@@ -64,5 +70,27 @@

# Short function description
# Standard function description
For all the functions above, additionnal arguments can be provided.
If a boolean is provided, it will turn the feature *on* or *off*.
For example `term.red( true )` turn all subsequent output in red, while `term.red( false )` disable red and go back to default color.
Without arguments, it is always the same as *true*, e.g. `term.red()` do the same thing than `term.red()`.
Some function cannot be turned off, they just perform an action.
For example `term.reset()` reset the terminal, usually to its default.
This is not reversible, thus `term.reset( false )` does nothing.
If the additional argument is a string, then it will be sent to the output directly after turning *on* the feature... then the feature is turn *off*.
That's it:
`term.red( 'Hello world!' )`
... is the same as:
`term.red( true ) ; term( 'Hello world!' ) ; term.red( false ) ;`.
Also those string support a printf()-like formating syntax.
So we can do `term.red( "My name is %s, I'm %d." , 'Jack' , 32 )` to output *"My name is Jack, I'm 32."*.
All those functions are chainable, and their arguments can be combined.
We can do:
`term.moveTo.red( 1 , 1 , "My name is %s, I'm %d.\n" , 'Jack' , 32 )` which will move the cursor to (1,1), then output *"My name is Jack, I'm 32."* in red.

@@ -153,3 +181,3 @@

* move(x,y): relative move of the cursor
* hideCursor(boolean): hide/show the cursor
* hideCursor(): hide/show the cursor

@@ -166,3 +194,3 @@

* eraseLine(): erase current line
* alternateScreenBuffer(boolean): this set/unset the alternate screen buffer, many terminal do not support it or inhibit it
* alternateScreenBuffer(): this set/unset the alternate screen buffer, many terminal do not support it or inhibit it

@@ -173,3 +201,3 @@

* requestCursorLocation(): request the cursor location, a 'terminal' event will be fired when available
* requestScreenSize(): request for screen size, a 'terminal' event will be fired when available (rarely useful, most of time this event is fired on resize)
* requestScreenSize(): **rarely useful** request for screen size, a 'terminal' event will be fired when available
* applicationKeypad(): should allow keypad to send different code than 0..9 keys, not widely supported

@@ -206,2 +234,3 @@

Quick example:

@@ -293,7 +322,7 @@

* SCREEN_SIZE: it is emited in response of a requestScreenSize(), data contains 'width' & 'height', the size of the screen in characters,
and 'resized' (true/false) if the size has changed
* SCREEN_RESIZE: it is emited when a terminal resizing is detected, most of time node.js will be notified of screen resizing, and so this event will be emited,
data contains 'width' & 'height', the size of the screen in characters
* SCREEN_RESIZE: it is emited when a terminal resizing is detected, most of time issuing a requestScreenSize() is useless,
node will be notified of screen resizing, and so this event will be emited
* SCREEN_SIZE: **rarely useful** it is emited in response of a requestScreenSize(), data contains 'width' & 'height', the size of the screen in characters,
and 'resized' (true/false) if the size has changed without node.js being notified

@@ -300,0 +329,0 @@ * FOCUS_IN: it is emited if the terminal gains focus (if supported by your terminal)

@@ -169,2 +169,5 @@ /*

// Request terminal ID
// requestTerminalId: { on: '\x1b[>c' } ,
// Terminal will send the cursor coordinate only one time

@@ -171,0 +174,0 @@ requestCursorLocation: { on: '\x1b[6n' } , // '\x1b[?6n' is not widely supported, '\x1b[6n' is better

{
"name": "terminal-kit",
"version": "0.1.11",
"version": "0.1.12",
"description": "Terminal utilities with supports for colors, styles, inputs, mouse and many more...",

@@ -5,0 +5,0 @@ "main": "lib/terminal.js",

@@ -12,6 +12,4 @@

Work in progress, only a rough documentation ATM.
# Features

@@ -34,8 +32,16 @@

```js
// Require the lib
var term = require( 'terminal-kit' ) ;
term( 'Hello world!\n' ) ; // output "Hello world!" normally
term.red( 'red' ) ; // output 'red' in red
term.bold( 'bold' ) ; // output 'bold' in bold
// output 'mixed' using bold, underlined red, exposing style-mixing syntax
// The term() function simply output a string to stdout, using current style
// output "Hello world!" in default terminal's colors
term( 'Hello world!\n' ) ;
// This output 'red' in red
term.red( 'red' ) ;
// This output 'bold' in bold
term.bold( 'bold' ) ;
// output 'mixed' using bold, underlined & red, exposing the style-mixing syntax
term.bold.underline.red( 'mixed' ) ;

@@ -64,5 +70,27 @@

# Short function description
# Standard function description
For all the functions above, additionnal arguments can be provided.
If a boolean is provided, it will turn the feature *on* or *off*.
For example `term.red( true )` turn all subsequent output in red, while `term.red( false )` disable red and go back to default color.
Without arguments, it is always the same as *true*, e.g. `term.red()` do the same thing than `term.red()`.
Some function cannot be turned off, they just perform an action.
For example `term.reset()` reset the terminal, usually to its default.
This is not reversible, thus `term.reset( false )` does nothing.
If the additional argument is a string, then it will be sent to the output directly after turning *on* the feature... then the feature is turn *off*.
That's it:
`term.red( 'Hello world!' )`
... is the same as:
`term.red( true ) ; term( 'Hello world!' ) ; term.red( false ) ;`.
Also those string support a printf()-like formating syntax.
So we can do `term.red( "My name is %s, I'm %d." , 'Jack' , 32 )` to output *"My name is Jack, I'm 32."*.
All those functions are chainable, and their arguments can be combined.
We can do:
`term.moveTo.red( 1 , 1 , "My name is %s, I'm %d.\n" , 'Jack' , 32 )` which will move the cursor to (1,1), then output *"My name is Jack, I'm 32."* in red.

@@ -153,3 +181,3 @@

* move(x,y): relative move of the cursor
* hideCursor(boolean): hide/show the cursor
* hideCursor(): hide/show the cursor

@@ -166,3 +194,3 @@

* eraseLine(): erase current line
* alternateScreenBuffer(boolean): this set/unset the alternate screen buffer, many terminal do not support it or inhibit it
* alternateScreenBuffer(): this set/unset the alternate screen buffer, many terminal do not support it or inhibit it

@@ -173,3 +201,3 @@

* requestCursorLocation(): request the cursor location, a 'terminal' event will be fired when available
* requestScreenSize(): request for screen size, a 'terminal' event will be fired when available (rarely useful, most of time this event is fired on resize)
* requestScreenSize(): **rarely useful** request for screen size, a 'terminal' event will be fired when available
* applicationKeypad(): should allow keypad to send different code than 0..9 keys, not widely supported

@@ -206,2 +234,3 @@

Quick example:

@@ -293,7 +322,7 @@

* SCREEN_SIZE: it is emited in response of a requestScreenSize(), data contains 'width' & 'height', the size of the screen in characters,
and 'resized' (true/false) if the size has changed
* SCREEN_RESIZE: it is emited when a terminal resizing is detected, most of time node.js will be notified of screen resizing, and so this event will be emited,
data contains 'width' & 'height', the size of the screen in characters
* SCREEN_RESIZE: it is emited when a terminal resizing is detected, most of time issuing a requestScreenSize() is useless,
node will be notified of screen resizing, and so this event will be emited
* SCREEN_SIZE: **rarely useful** it is emited in response of a requestScreenSize(), data contains 'width' & 'height', the size of the screen in characters,
and 'resized' (true/false) if the size has changed without node.js being notified

@@ -300,0 +329,0 @@ * FOCUS_IN: it is emited if the terminal gains focus (if supported by your terminal)

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