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

milena

v0.1.15

Published

TypeScript CLI-Tools

Downloads

3

Readme

Milena

A simple and lightweight TypeScript-Class to create CLI-Applications on Node.js.

Installation

Run npm i milena

Import

const milena = require("milena");
const pp = new milena.Prompt();
--> Example: pp.printLine();

Methods

close()

Destroy stdin and exit process if necessary.

Parameters:
  • exitProcess:Boolean
Use:
pp.close(true);

choose()

Set prompt which lets the user choose between two options.

Parameters:
  • output:string
  • charTrue:string
  • charFalse:string
  • msgTrue:string
  • msgFalse:string
  • abortOnWrongChar
Use:
let choose = await pp.choose("Choose X(=true) or Y(=false):", "x", "y", "X", "Y", false);
pp.print("Your Input: " + choose);

input()

Set prompt for user-input.

Parameters:
  • output:string
Use:
let input = await pp.input("Give me Input >>");
pp.print("Your Input: " + input);

multiSelect()

Set prompt which lets the user select 0 or more options.

Parameters:

  • output:string
  • options:string[]
  • min:number (not activated)

Use:

let options:string[] = ["Option 1", "Option 2", "Option 3"];
let multiselect = await pp.multiSelect("Select Options:", options, 0);
pp.print("Your Input: " + multiselect);

print()

Print output to stdout in default-color (white).

Parameters:

  • output:string|number|boolean

Use:

pp.print("Default-Text");

printColorBlack()

Print output to stdout in black color.

Parameters:

  • output:string|number|boolean

Use:

pp.printColorBlack("Default-Text");

printColorBlue()

Print output to stdout in blue color.

Parameters:

  • output:string|number|boolean

Use:

pp.printColorBlue("Default-Text");

printColorCyan()

Print output to stdout in cyan color.

Parameters:

  • output:string|number|boolean

Use:

pp.printColorCyan("Default-Text");

printColorGreen()

Print output to stdout in green color.

Parameters:

  • output:string|number|boolean

Use:

pp.printColorGreen("Default-Text");

printColorMagenta()

Print output to stdout in magenta color.

Parameters:

  • output:string|number|boolean

Use:

pp.printColorMagenta("Default-Text");

printColorRed()

Print output to stdout in red color.

Parameters:

  • output:string|number|boolean

Use:

pp.printColorRed("Default-Text");

printColorWhite()

Print output to stdout in white color.

Parameters:

  • output:string|number|boolean

Use:

pp.printColorWhite("Default-Text");

printColorYellow()

Print output to stdout in yellow color.

Parameters:

  • output:string|number|boolean

Use:

pp.printColorYellow("Default-Text");

printCommand()

Print output to stdout in command-color (green).

Parameters:

  • output:string|number|boolean

Use:

pp.printCommand("Command-Text");

printError()

Print output to stdout in error-color (red).

Parameters:

  • output:string|number|boolean

Use:

pp.printError("Error-Text");

printInput()

Print output to stdout in input-color (white).

Parameters:

  • output:string|number|boolean

Use:

pp.printInput("Input-Text");

printLine()

Print a line to stdout in line-color (white). Line-width is defined in /lib/config.json

Parameters:

  • NONE

Use:

pp.printLine();

printOption()

Print output to stdout in option-color (yellow).

Parameters:

  • output:string|number|boolean

Use:

pp.printOption("Option-Text");

printSelected()

Print output to stdout in selected-color (cyan).

Parameters:

  • output:string|number|boolean

Use:

pp.printSelected("Selected-Text");

printTitle()

Print output to stdout in title-color (magenta).

Parameters:

  • output:string|number|boolean

Use:

pp.printTitle("Title-Text");

select()

Set prompt which lets the user select one option.

Parameters:

  • output:string
  • options:string[]

Use:

let options:string[] = ["Option 1", "Option 2", "Option 3"];
let select = await pp.select("Select one Option:", options);
pp.print("Your Input: " + select);

Colors

All colors are defined in /lib/config.json

Async/Await

In most cases, a CLI-Application needs to wait for User-Input, like in the Examples above. It is also possible, to use the methods without "await" for asynchronous and non-blocking code.

Parameters

None

Export-Methods

getInputDataTypes()

Gets back the following Types

  • Array
  • Boolean
  • Number
  • String

Parameters:

  • none

Use:

import{getInputDataTypes} from "milena";

let types:string[] = getInputDataTypes();

getInputTypes()

Gets back the following Types

  • Choose
  • Input
  • MultiSelect
  • Select

Parameters:

  • none

Use:

import{getInputTypes} from "milena";

let types:string[] = getInputTypes();