How to use the terminal-kit.terminal.singleColumnMenu function in terminal-kit

To help you get started, we’ve selected a few terminal-kit examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github DefinitelyTyped / DefinitelyTyped / types / terminal-kit / terminal-kit-tests.ts View on Github external
term.singleLineMenu(items1, options, (error: any, response: any) => {
  term("\n").eraseLineAfter.green(
    "#%s selected: %s (%s,%s)\n",
    response.selectedIndex,
    response.selectedText,
    response.x,
    response.y
  );
});

term.cyan("The hall is spacious. Someone lighted few chandeliers.\n");
term.cyan("There are doorways south and west.\n");

const items2 = ["a. Go south", "b. Go west", "c. Go back to the street"];

term.singleColumnMenu(items2, (error: any, response: any) => {
  term("\n").eraseLineAfter.green(
    "#%s selected: %s (%s,%s)\n",
    response.selectedIndex,
    response.selectedText,
    response.x,
    response.y
  );
});

term.cyan("Choose a file:\n");

const items = fs.readdirSync(process.cwd());

term.gridMenu(items, (error: any, response: any) => {
  term("\n").eraseLineAfter.green(
    "#%s selected: %s (%s,%s)\n",
github cronvel / terminal-kit / sample / single-column-menu-todoc2.js View on Github external
*/
"use strict" ;

var term = require( 'terminal-kit' ).terminal ;

term.clear() ;
term.cyan( 'Where will you go?\n' ) ;

var items = [
	'a. Go north' ,
	'b. Go south' ,
	'c. Go east' ,
	'd. Go west'
] ;

var menu = term.singleColumnMenu( items , { continueOnSubmit: true } ) ;

menu.on( 'submit' , data => {
	term.saveCursor() ;
	term.moveTo( 1 , term.height - 1 , "Submit: %s" , data.selectedText ) ;
	term.restoreCursor() ;
} ) ;

term.on( 'key' , key => {
	if ( key === 'CTRL_C' ) {
		term.grabInput( false ) ;
		process.exit() ;
	}
} ) ;
github cronvel / terminal-kit / sample / single-column-menu-doc1.js View on Github external
SOFTWARE.
*/
"use strict" ;

var term = require( 'terminal-kit' ).terminal ;

term.cyan( 'The hall is spacious. Someone lighted few chandeliers.\n' ) ;
term.cyan( 'There are doorways south and west.\n' ) ;

var items = [
	'a. Go south' ,
	'b. Go west' ,
	'c. Go back to the street'
] ;

term.singleColumnMenu( items , function( error , response ) {
	term( '\n' ).eraseLineAfter.green(
		"#%s selected: %s (%s,%s)\n" ,
		response.selectedIndex ,
		response.selectedText ,
		response.x ,
		response.y
	) ;
	process.exit() ;
} ) ;
github iTexZoz / JetbrainIDE-CFX.RE / main.ts View on Github external
if (stats.native.current == stats.native.total)
            process.exit();
    };

}


term.cyan('Welcome to the native completion generator tool for Jetbrain IDEs for cfx.re projects.\n');
term.cyan('Please select the game concerned.\n');

let items = [
    '1. FiveM',
    '2. RedM',
];

term.singleColumnMenu(items, function (error, response) {
    switch (response.selectedIndex) {
        case 0:
            new Main.onEnable("build/cfx/fivem", GamesType.FiveM);
            break;
        case 1:
            new Main.onEnable("build/cfx/redm", GamesType.RedM);
            break;
        default:
            new Main.onEnable("build/cfx/fivem", GamesType.FiveM);
            break;
    }
    //process.exit();
});

//new Main.onEnable("build/cfx/fivem", GamesType.FiveM);
github opendnd / dynastia / lib / program-render.js View on Github external
const displayPersonList = () => {
      term.clear();
      term.white('Please select a person from the Dynasty below for more information:\n\n');
      const items = Object.values(persons).map(nPerson => colors.white(Renderer.name(nPerson, yearFormat)));
      term.singleColumnMenu(items.concat(['↵  Exit']), displayPerson);
    };
github Automattic / wp-calypso / bin / analyze-css.js View on Github external
const render = () => {
	term.fullscreen();
	term.inverse( padLine( 'Use the arrow keys and BACKSPACE to navigate, ENTER to select, and ESC to quit' ) );
	term( '\n' );
	term.bold( padLine( `--- ${ current.path } `, '-' ) );

	if ( menu ) {
		menu.abort();
	}

	menu = term.singleColumnMenu(
		getMenu( current, term.height - 4 ),
		{ selectedIndex: current.index },
		( error, { selectedIndex } ) => {
			const selectedDirectory = current.items[ selectedIndex ].name;
			const selectedPath = path.resolve( current.path, selectedDirectory );
			const stats = fs.statSync( selectedPath );

			if ( stats.isDirectory() ) {
				current = Folder( selectedPath );
			} else {
				current.index = selectedIndex;

				term.bell();
			}

			render();