GUIs for the command line
.______ __ __|__|_/ ___\| | \ |\ \___| | / |\___ >____/|__|\/
GUIs for the command line.
Command line programs can be hard to learn / use / build.
cui is a preinstantiated object that can be
require()'d by multiple files and maintain its state. Use
cui.splice() to add views or actions (see the Usage section) to a sequence of frames. Users of your program only need to know the name of your program - cui can walk them through providing the rest of the arguments on its own. If a user does know the full command, they can still type it out of course, for example running the basic example any of the following ways is valid:
example/basic Three hi!
npm install cui
The examples are all executable scripts - try cd'ing into the example folder and typing
This code below is essentially the same as in example/basic:
var cui = require'cui'cuipushtitle: 'This is a very basic example.'type: 'buttons'data:'One''Two''Three'cuipushif cuilast1 === 'Three'cuisplicetitle: 'Three is a special choice!'type: 'fields'data: 'Please type a word and press ENTER: 'cbcuipushconsole.log'You could do something now with: "' + cuiresultsjoin'" and "' + '"'cb
argsany arguments passed
resultsan array of results collected by views or manually augmented by actions
cachea cache object that will be automatically loaded & saved if not null (as a json file named '.cui')
push()add a view or function to the end of the sequence
splice()add a view or function after the current frame
cui.results[results.length - n]
console.log()but with the same indentation level as specified in
save()persist the cache now - useful if your script may encounter future errors and exit early