move-terminal-cursor

0.0.4 • Public • Published

Move Terminal Cursor

Move a terminal cursor (right, left, up, down, etc).

Install

$ npm install --save move-terminal-cursor 

Usage

var move = require("move-terminal-cursor")
 
move("up", {count: 5})
move("down", {count: 5})
move("right", {count: 5})
move("left", {count: 5})
move("nextLine", {count: 5})
move("prevLine", {count: 5})
move("toCol", {col: 10})
move("toPos", {row: 10, col: 10})
 
console.log("Meow")

API

move(type, opts)

Moves the terminal cursor.

Name Type Description
type String Where you want the cursor to move.
opts Object Options (see available options below)

Available types

types
up
down
right
left
nextLine
prevLine
toCol
toPos

Available options

Name Type Description
x Number The x cord.
y Number The y cord.
count Number The number of movements.

Required options for movement types.

"up"

move("up", opts)

Must provide 'count' key/value to options object.

move("up", {count: 5})

"down"

move("down", opts)

Must provide 'count' key/value to options object.

move("down", {count: 5})

"right"

move("right", opts)

Must provide 'count' key/value to options object.

move("right", {count: 5})

"left"

left("right", opts)

Must provide 'count' key/value to options object.

move("left", {count: 5})

"nextLine"

move("nextLine", opts)

Must provide 'count' key/value to options object.

move("nextLine", {count: 5})

"prevLine"

move("prevLine", opts)

Must provide 'count' key/value to options object.

move("prevLine", {count: 5})

"toCol"

move("toCol", opts)

Must provide 'col' key/value to options object.

move("toCol", {col: 5})

"toPos"

move("toPos", opts)

Must provide 'col' and 'row' key/values to options object.

move("toPos", {row: 5, col: 10})

Related

  • terminal-cursor - Manipulate and keep track of the terminal cursor (move, hide, show, etc)

License

MIT © Joe Gesualdo

Readme

Keywords

Package Sidebar

Install

npm i move-terminal-cursor

Weekly Downloads

4

Version

0.0.4

License

MIT

Last publish

Collaborators

  • joegesualdo