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

cli-features

v1.2.2

Published

Convenient interface for communicating with user from command line

Downloads

3

Readme

 ┌─┐┬   ┬          ┌─┐┌─┐  ┌─┐┌┬┐ ┬   ┬ ┬─┐┌─┐┌─┐  │     │   │  ───    ├┤  ├┤   ├─┤  │   │  │ ├┬┘├┤   └─┐  └─┘┴─┘┴           └     └─┘ ┴  ┴   ┴   └─┘ ┴└─└─┘└─┘

Convenient interface for communicating with user from command line

Main memo

  • Install: npm install concolor
  • Require:
const { Questioner, EscSequences } = require('cli-features');

Base Usage

const { Questioner } = require('cli-features');

const { generalQuestion } = new Questioner({
  input: process.stdin,
  output: process.stdout,
});

generalQuestion('What is your name?').then(console.log);

General question

Examples: 1_generalQuestion.js

Alternative question

alternativeQuestion(

  • questionStr: string - the line that will be printed at the start of the poll. (mandatory)
  • answers: array[string] || object{string: boolean} - possible answer options. If answers is an object, then instead of choosing one option, it becomes possible to select several (you can also specify which options will be enabled by default, by specifying the true key). (mandatory)
  • options: {
    • maxLength: number - the maximum length of the list, after exceeding which, the list will be partially displayed
    • startWith: number - starting element index
    • isRounded: boolean - indicates whether the list looped back }

) => string || array[string] - selected points

Examples: 2_alternativeQuestion.js

ESC sequences

Remember!!! Esc sequences must be printed, otherwise there will be no effect!!!

EscSequences{

  • movement {
    • moveRelX (dx number) - moves the cursor along the x-axis by dx columns
    • moveRelY (dy number) - moves the cursor along the y-axis by dy rows
    • moveRel (dx number, dy number) - moves the cursor along the x-axis by dx columns and along the y-axis by dy rows
    • moveAbsX (x number) - moves the cursor to the point corresponding to the coordinate x
    • moveAbsY (y number) - moves the cursor to the point corresponding to the coordinate y
    • moveAbs (x number, y number) - moves the cursor to the point corresponding to the coordinates x, y }
  • visibility {
    • setInvisibleMode () - makes the cursor invisible
    • setVisibleMode () - makes the cursor visible }
  • deleting {
    • deleteStartToCur () - clears the line from the current cursor position to the end of the line
    • deleteCurToEnd () - clears the line from the beginning of the line to the current cursor position
    • deleteAllLine () - clears the whole line }
  • decoration {
    • normal - character after which everything printed will have its original form
    • bold (string string) - makes the text bold
    • underlined (string string) - makes text underlined
    • invert (string string) - inverts the color of the text
    • setForegroundColor (color number || string, isBright boolean) - set text foreground color, if isBright is true, then another color pad will be used
    • setBackgroundColor (color number || string, isBright boolean) - set text background color, if isBright is true, then another color pad will be used
    • setTheme ({ options = array[string], foregroundColor number || string, isForeColorBright boolean, backgroundColor number || string, isBackColorBright boolean, }) - foregroundColor and isForeColorBright correspond to color and isBright from setForegroundColor (), so do backgroundColor and isBackColorBright, in options you can pass something like ['bold', 'underlined'], to styling the text }

      Possible colors: 'black', 'red', 'green', 'yellow', 'blue', 'magenta', 'cyan', 'white' Their numbers:  0,   1,   2,     3,   4,     5,    6,      7

}

Examples: escSequences.test.js