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

dscom

v1.0.51

Published

A tool to create command line applications.

Downloads

5

Readme


GitHub top language GitHub repo size npm own loads GitHub latest release GitHub latest version GitHub last commit GitHub commit actiivty GitHub followers GitHub stars GitHub watchers

What Is It?

A tool for making command line tools with TypeScript or Javascript using Node.Js. It handles command line args, user input, help screen, colored messages, progress bars, and so on.

Why?

To make an easy chainable way to create a CLI fast. This provides a complete package for basic or advanced command line tools with many customizable options. The aim is to create an enjoyable and understadnable syntax that allows for efficent creation of command line user interfaces so developers can focus more on developing their applications.

How To Start

Vist The Wiki

Start a new node project and install typescript and dscom .

  npm init
  npm i --save-dev typescript @types/node
  npm i --save dscom

Make sure to set the type to module in the package.json file also.

In your typescript config file set the types and target to be.

{
    "target": "ESNext", 
    "module": "ESNext", 
    "moduleResolution": "node", 
    "types": ["node", "dscom"]
}

And then you can simply require the dsCom object and define it as DSCommander.

See the code bellow to get started quickly. It shows the program setting up input params, logging some text, and then asking for the user's input and displaying their input.

Starter Code

import * as readline from 'node:readline';
import {DSCommander} from "../../dist/index.js";
const dsCom = new DSCommander(readline);
(async () => {
    //Add params to the program
    dsCom
    .addParam({
        flag: "a",
        name: "auto",
        desc: "Auto parse",
        type: "string[]",
        required: false,
        valueNeeded: true,
    })
    .addParam({
        flag: "b",
        name: "batch",
        desc: "Batch parse",
        type: "boolean",
        required: false,
        valueNeeded: true,
    })
    .addParam({
        flag: "c",
        name: "cache",
        desc: "Cache",
        type: "boolean",
        required: false,
        valueNeeded: true,
    });
    //Get the params input
    (await dsCom.initProgramInput()).$ENABLESHOW //enable use of show functions
        .defineSleepTime(100)
        //Check if they are set
        .ifParamIsset("a", (value: any, args: any) => {
            dsCom.showSleep(value, "Info");
        })
        .ifParamIsset("b", (value: any, args: any) => {
            dsCom.showSleep(value, "Info");
        })
        .ifParamIsset("c", (value: any, args: any) => {
            dsCom.showSleep(value, "Info");
        })
        .newScreen()
        .RAW.show(dsCom.getParam("a"))
        .show(dsCom.getParam("b"))
        .show(dsCom.getParam("c"))
        .sleep(1000)
        //Start a new screen
        .splashScreen()
        .BLINK.showSleep("BLINK")
        .INFO.showSleep("Some Info.")
        .GOOD.showSleep("Everything is fine.")
        .ERROR.showSleep("Everything is not fine.")
        .WARNING.showSleep("Something may be wrong.")
        .sleep(500)
        .CLEAR
        //Show message in boxes
        .BOX_IN.BOX_DASHED_HEAVY_4.BTAC.BR.G.show([
            "Divine Star Software",
            "Presents",
            "Divine Star Commander",
            "The Ultimate Command Line Interface",
            "Creation Tool",
        ])
        .sleep(500)
        .BOX_END.BOX_IN.BOX_TEXT_ALIGN_RIGHT.BR.B.show([
            "Divine Star Software",
            "Presents",
            "Divine Star Commander",
            "The Ultimate Command Line Interface",
            "Creation Tool",
        ])
        .BOX_END.sleep(500)
        //Add a progress and service bar
        .newProgressBar("test");
    await dsCom.incrementProgressBar("test", 100);
    dsCom.newServiceBar("test");
    (await dsCom.asyncSleep(3000))
        .destroyServiceBar("test")
        .newScreen()
        .showSleep("All good.", "Raw")
        .newScreen()
        //Get users input
        .show("Starting user input", "Info")
        .ask("enter name", "name", "string")
        .ask("enter num", "num", "number");
    (await dsCom.startPrompt())
        .showSleep(dsCom.getInput("name"), "Info")
        .restartPrompt()
        .ask("enter email", "email", "email")
        .ask("enter password", "pass", "password")
        .fail(true, "Password is not correct.", 3, () => {
            process.exit(0);
        })
        .ask("enter comment", "comment", "string");
    (await dsCom.startPrompt()).ifInputIsset("comment", (value: any) => {
        dsCom.INFO.show(value);
    });
})();