CLI-GUI2
CLI-GUI - but much better. Graphical interface in command line.
Features
- List
- Checklist
- Search
- Table
- Prompt
- Guided prompt
- Log
- Terminal
- Box
- Editor
Documentation
Installation
npm install cligui2
Usage
var CliGui = ;var interface = ;
interface.stop - Stop interface
This stops the interface completely
interface.done - Remove layer
Used to remove "layers".
interface.reset - Reset interface
Resets interface
interface.addListener
Arguments: target,function
Adds a listener to a target
Available targets:
- key - Key presses
interface.removeListener
Arguments: target,function
Removes a listener from a target
interface.clearListeners
Arguments: target
clears listeners from a target
interface.list - List items
Arguments: title,items,call
The list function is very flexible. It can be called in four different ways.
- Options argument as an array of strings, call argument a function
- Options argument as an array of strings, call argument as an array of functions
- Options argument as an array of objects
- Options argument as an object
Example:
interface interface interface interface
interface.checklist - List items as a checklist
Arguments: title,items,call
The checklist function is also as flexible as the list function. For usage, please refer to the list documentation. A option can also be checked on by default. To do so please set checked
to true.
Example:
interface
interface.search - List items as a searchable list
Arguments: title,items,call
Usage is same as the usage for the List function
interface.table - List items as a table
Arguments: title,data
Data is an object
Example:
interface
interface.prompt - Prompt the user (text input)
Arguments: title,shadow,call
The prompt funcion prompts the user for a text input.
Example:
interfaceprompt"this is a prompt""type something" { }
The guided prompt function allows for a user-guiding prompt system
Example:
var options = name: "hello" description: "Hello world" // optional options: // optional, sets arguments (ex: hello [arg1]) name: "arg1" options: "a""b""c" // optional, sets selectable options for the argument description: "argument 1" // optional name: "hello_again" // spaces are not allowed interface
Returns: logger
Functions:
- logger.log(string) - log string
- logger.slow(string,time,callback) - log string with typing animation
- logger.clear() - clear display
- logger.clearRow() - clear recent row
Example:
var logger = interfacelogger
interface.terminal - Terminal
Arguments: title,startchar,callback
Returns: logger
Functions:
- logger.log(string) - log string
- logger.slow(string,time,callback) - log string with typing animation
- logger.clear() - clear display
- logger.clearRow() - clear recent row
Example:
var logger = interfacelogger
interface.box - Popup box
Arguments: x,y,width,height,content,options,call
Example:
var logger = interface {if key == "ESC" interface} interface; // add keypress listener logger
interface.editor - File editor
Arguments: file,callback
Example:
interface