1.1.1 • Published 8 years ago
node-console-interface v1.1.1
Functions
getConsoleGridInterfaceInput (horizontalBorder, verticalBorder, spacer, marker, startX, startY, borderWidth, borderHeight, showCoords, showIntructions, deleteOnCompletion)
Basic Overview
Will display a grid for the user to move around a marker with WASD keys in order to select a pair of co-ordinates.
Variables
horizontalBorderrefers to the top and bottom border characters.verticalBorderrefers to the left and right border characters.spacerrefers to the characters inside the grid. (Space is recommended)markerrefers to the marker character that will be put at the selected co-ordinates.startXandstartYrefers to where the marker character will start on the grid.borderWidthandborderHeightrefers to the width and height of the grid.- If
showCoordsis true, the user will see their X and Y position at the bottom of the console window. - If
showInstructionsis true, the user will see instructions on how to use the interface at the top of the console window. - If
deleteOnCompletionis true, the grid will be deleted once the user selects their co-ordinates.
Usage
Input:
const conif = require('node-console-interface');
var coords = conif.getConsoleGridInterfaceInput('-', '|', ' ', 'O', 25, 12, 50, 25, true, true, true);
console.log('PosX: ' + coords.x);
console.log('PosY: ' + coords.y);Output:

getConsoleSliderInterfaceInput (leftEndChar, rightEndChar, spacer, marker, startValue, sliderWidth, showValue, showIntructions, deleteOnCompletion)
Basic Overview
Will display a slider for the user to move around a marker with A and D keys in order to select a value.
Variables
leftEndCharrefers to the character that will be on the left of the slider.rightEndCharrefers to the character that will be on the right of the slider.spacerrefers to the characters inside the slider. ('-'is recommended)markerrefers to the marker character that will be put at the selected value.startValuerefers to where the marker character will start on the slider.sliderWidthrefers to the width and height of the slider.- If
showValueis true, the user will see the value at the right of the slider. - If
showInstructionsis true, the user will see instructions on how to use the interface at the top of the console window. - If
deleteOnCompletionis true, the slider will be deleted once the user selects their co-ordinates.
Usage
Input:
const conif = require('node-console-interface');
var value = conif.getConsoleSliderInterfaceInput('<', '> ', '-', 'O', 25, 50, true, true, true);
console.log('Value: ' + value + '\n');Output:

getConsoleSelectionListInterfaceInput (marker, selectedMarker, startPosition, items, showIntructions, deleteOnCompletion)
Basic Overview
Will display a list in which the user and move a marker up and down in order to select a particular item.
Variables
markerrefers to the marker put next to each item on the list.selectedMarkerrefers to the marker put next to an item on the list when it is selected.startPositionrefers to the start position of the selection.itemsrefers to the array of items in the list.- If
showInstructionsis true, the user will see instructions on how to use the interface at the top of the console window. - If
deleteOnCompletionis true, the list will be deleted once the user selects their item.
Usage
Input:
const conif = require('node-console-interface');
var items = new Array();
items.push("Name1");
items.push("Name2");
items.push("Name3");
items.push("Name4");
var selection = conif.getConsoleSelectionListInterfaceInput('| ', 'O ', 1, items, true, true);
console.log('Selection: ' + selection + '\n');Output:
