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

culinary

v1.1.6

Published

Add advanced CLI behavior to your NodeJS program with Culinary!

Downloads

38

Readme

Culinary Logo

Add advanced command-line interface to your NodeJS program with Culinary!

Culinary is an advanced module that mostly takes care of all ANSI tasks of NodeJS using a common programming interface. The main purpose of this package is to serve herb for low-level console manipulation so I highly recommend that you check it out but if you need direct access to the CLI without any layers on top then Culinary is for you!

Installation

npm install culinary --save

Usage

var culinary = require('culinary');
var style = culinary.style;

// Get screen dimensions using .size or .dimensions
var screen = culinary.size();

// Save cursor position
culinary.save();
// Move cursor to the last visible line and erase that line (Commands can be chained)
culinary.position(0, screen.height).eraseLine();

// Write time in bold green
culinary.write(style((new Date()).toString()).spice("green","bold"))
// Restore cursor position
culinary.restore();

Methods

write(string:String)

Similar to console.log but does not create a new line or accept more than a String argument. For more advanced writing check out herb

up(n:Integer), down(n:Integer), back(n:Integer), forth(n:Integer)

Allows you to move the cursor n number of times relative to its current position. Other aliases for back and forth are left and right.

scrollUp(), scrollDown()

Scrolls the content by a single line. Useful for modifications to native logs.

nextLine()

Moves to the next line. Similar behavior as "\n".

save(), restore()

Allows for saving and restoration of the current cursor position. There is currently no way (that I am aware of) that enables multiple saves and restoration. Use it wisely!

cursor(visible:Boolean), hideCursor(), showCursor()

Allows for manipulation of cursor state between visible & hidden. WARNING: If cursor state is not set to visible before the application is closed the cursor will remain hidden. This will have a negative User Experience effect. Use it at your own discretion

clearScreen(direction:String), cls()

Allows for clearing content relative to the direction or entirely. Direction can be set up, down or entire to clear the entire console screen.

eraseLine(direction:String), clearLine(direction:String)

Allows for clearing line content relative to the direction or entirely. Direction can be set left, right or entire to clear the entire line.

bell() - Ring it!

Colors & Spices

As an addition to Culinary you can add styles to Strings. Simply assign culinary.style and use the .spice() method or one of the aliases (addStyle, addStyles, setStyle, setStyles).

spice(color:String ... spice:String)

There are no limits to how many colors or spices you can add to a string as long as it matches one of the options below:

  • Colors: Black, White, Green, Blue, Cyan, Magenta, Red, Yellow
  • Backgrounds: bgBlack, bgWhite, bgGreen, bgBlue, bgCyan, bgMagenta, bgRed, bgYellow
  • Spices: bold, underline, ~~strikethrough~~ (barely supported by clients), italic, hidden, invert, reset Note: Since version 1.1.4 you can apply arguments directly to style element. The goal of culinary is to provide low-level access and the current spice model did not fit the criteria yet I'll support legacy versions until the next major release.

var culinary = require('culinary');
var style = culinary.style;

culinary.write(style.apply({
    string: "Put your text here",
    background:<ANSI code>,
    color:<ANSI code>,
    special:<ANSI code>
}, [array of optional spices]);

// Or the easy method
culinary.write(style("Super text!").spice("red","bold","bgWhite","italic"))
culinary.nextLine();
//

Contributing

If you are interested you can contact me directly at [email protected]!

License

MIT © Schahriar SaffarShargh [email protected]