npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

menu

v0.2.5

Published

A terminal menu for your node.

Downloads

319

Readme

menu

A cli menu for your node.

Install

build alt platform alt

npm install menu

ScreenShot1

API

Tabs

Menu is built around tabs. There are currently four types:

  • Toggle: This tab functions like a button.
  • List: This tab selects a single value from its list.
  • Search: This tab takes a string input, and has the function of a list tab.
  • Select: This tab creates a selectable drop-down list.

These tabs are declared as such...

var content = {
	tab1: {title:"column1", seltitle: "COLUMN1", type:"toggle", val:"true", color:"blue"},
	tab2: {title:["column2", "column22"], seltitle: ["COLUMN2", "COLUMN22"], type:"search", input: 0, val:"abcdefgh", color:"red"},
	tab3: {title:"column3", seltitle: "COLUMN3", type:"list", input: 0, val:["a", "b", "c"], color:"white"},
	tab4: {title:"column4", seltitle: "COLUMN4", type:"select", input: 0, val:["1","2","3","4","5","6"], color:"green"}
}

Properties

title: This is the tabs label when it's not focused. seltitle: This is the tabs label when it is focused. type: This is the tab's type. input: This is the index value for a list, select, and search tabs. val: For type toggle, it's a boolean value. For types list and select, it's an array of values. For type search it's a string. color: The tab's set color. Look at the node clivas for all possible values.

Initialization

var menu = require('./index.js');

menu.init(content);					

menu.draw()							//this draws the headers

menu.clivas							//you can custom draw with clivas

Delegate

function work() {
    menu.start(options, function(result) {
        var key = result[0]; 						//refer to node keypress for all properties
        var column = result[1]; 					//the focused tab
        
        menu.draw();								//draw tabs
        
        if(key.name=="return" && column.id === 4) {			
			menu.clivas.line(Math.abs(column.input%column.val.length));	//always mod your column input to determine focused index
		} else if(key.name=="return" && column.id === 2) {
			menu.clivas.line("You searched for "+column.val);
			column.val = "";
		} else if(key.ctrl && key.name ==="c") {
			process.exit();
		} else if(key.name ==="backspace") {
			
		} else if(key.name ==="left") {
			
		} else if(key.name ==="up") {
			
		} else if(key.name ==="down") {
			
		} else if(key.name ==="right") {
			
		} else {
			
		}
	
		if(column.id === 1) {					//use tab 1 to toggle tab 4's select contents
			if(column.val) {
				menu.columns["tab4"].val = ["z","y","x","w"];
			} else {
				menu.columns["tab4"].val = ["1","2","3","4","5","6"];
			}
			menu.draw();
		}
    })
} work();