0.0.3 • Published 8 years ago

terminal-cursor v0.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
8 years ago

Terminal Cursor Build Status

Manipulate the terminal cursor (move, hide, show, etc)

Install

$ npm install --save terminal-cursor 

Usage

var Cursor = require("terminal-cursor")

var cursor = new Cursor(0, 0)
cursor.move("down", 2)
console.log("Hello")
cursor.move("down", 4)
console.log("World")

Test

$ npm test

API

new Cursor(xPos, yPos)

Creates an instance of Cursor at a given position

NameTypeDescription
xPosNumberx coordinate of the cursor you are creating
yPosNumbery coordinate of the cursor you are creating

Returns a Cursor instance

var Cursor = require("terminal-cursor")

var cursor = new Cursor(0, 0)
cursor.move("down", 2)
console.log("Hello")
cursor.move("down", 4)
console.log("World")

move(type, count)

Moves the cursor in a given position

NameTypeDescription
typeStringType of movement: "up", "down", "right", "left"
countNumberHow many times should the cursor move.
var Cursor = require("terminal-cursor")

var cursor = new Cursor(0, 0)
cursor.move("down", 2)
console.log("Hello")
cursor.move("down", 4)
console.log("World")

movePos(xPos, yPos)

Moves the cursor to a given coordinate

NameTypeDescription
xPosNumberThe x coordinate where you want to move the cursor.
yPosNumberThe y coordinate where you want to move the cursor.
var Cursor = require("terminal-cursor")

var cursor = new Cursor(0, 0)
cursor.movePos(5, 10)
console.log("Hello")

show()

Displays the cursor

hide()

Hides the cursor

License

MIT © Joe Gesualdo