1.0.6 • Published 7 years ago

console-interface v1.0.6

Weekly downloads
8
License
ISC
Repository
-
Last release
7 years ago

Instalation

npm install --save console-interface

Usage

const { console } = require('console-interface')

line()

Prints line with given pattern (defauld '-')

console.line('-=')

write()

Write object as string to console, can align text, don't change line.

console.write('LEFT', 'left')
console.write('CENTER', 'center')
console.write('RIGHT', 'right')

writeLine()

Same as write but changes cursor to begining of next line.

console.writeLine('<~ Heading ~>', 'center')

log()

Old console.log

clear()

Clears screan.

color

Get or set color of text.

console.color = 'red'
console.color

bgColor

Get or set color of background.

console.bgColor = 'white'
console.bgColor

height

Get console height.

width

Get console width.

size

Get console size as [width, height]

ask()

Gets user input.

const name = console.ask('What is your name? ')

question()

Alias to console ask

select()

Creates menu with checkboxes

console.writeLine('What programing languages you know?')
console.select([
    { label: 'JavaScript' selected: true },
    { label: 'C++' selected: true },
    { label: 'C#' selected: true },
    { label: 'GO' },
    { label: 'R' },
    { label: 'ASM' },
    { label: 'C' },
    { label: 'TypeScript' },
    { label: 'CoffeScript' },
    { label: 'Python' },
    { label: 'Java' },
    { label: 'HTML' },
    { label: 'CSS' },
]).then(items => {

})

selectOne()

Creates menu with radio.

console.writeLine('What is the best programing language?')
console.select([
    { label: 'JavaScript' selected: true },
    { label: 'C++' },
    { label: 'C#' },
    { label: 'GO' },
    { label: 'R' },
    { label: 'ASM' },
    { label: 'C' },
    { label: 'TypeScript' },
    { label: 'CoffeScript' },
    { label: 'Python' },
    { label: 'Java' },
    { label: 'HTML' },
    { label: 'CSS' }
]).then(item => {

})

pickOne()

Creates menu that changes while navigating presing enter confirms.

console.writeLine('Do you like it?')
console.select([
    { label: 'Yes' },
    { label: 'No' }
]).then(item => {

})
1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago