Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

supercli

Package Overview
Dependencies
Maintainers
1
Versions
9
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

supercli

A lightweight library for Node.js that will help developers display nice, pretty, colored messages in a console windows.

  • 0.4.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

THIS PROJECT HAS BEEN DEPRECATED AND MOVED TO REX-SHELL. ALL FUTURE DEVELOPMENT WILL BE ON REX-SHELL.

SuperCLI (DEPRECATED, RETIRED, DEAD, etc.)

A lightweight library for Node.js that will help developers display nice, pretty, colored messages in the console.

Note for NPM Viewers:

For some reason, NPM has not implemented anything more than the most basic Markdown rendering engine for these readme files. As such, the API reference tables at the bottom of this readme are literally unusable. It's much better to view this readme on GitHub directly here: GitHub Readme

How to use it

  1. Require it
var scli = require('supercli');
  1. Use that sheezy like this:
At its most simple, you can just send messages directly from that.
scli("This will send a log message to the console");

Remember: Log as many things as you want!

Don't worry about whether the message is a string, object, integer, whatever. It doesn't matter at all. Any arguments you pass to SuperCLI will get logged properly, no matter what. It's all about rapid development, baby!

scli("String", 42, false, ["a", 1, {foo : bar}], { baz : { bax : zap } });

Outputs

[ SuperCLI: Log ] String 42 false [a, 1, {foo : bar}] { baz : { bax : zap } }

sigh Yeah, I know. Soak it up, baby. SuperCLI gon' be gooood to you.

Alright let's get to the good stuff.

Simple logs
scli.log("An event happened that you shouldn't be worried about");
scli.lg("Save yourself a whole letter when calling this! You're welcome.");

Rather Important Note: As far as I can tell, most of the time people just need basic log messages. The above 3 functions will make that happen, and are identical. I just tried to get more options for people to be comfortable.

scli("Your log message here!");
scli.log("Your log message here!");
scli.lg("Your log message here!");

So yeah. Just giving you a heads up. Because I'm a nice guy like that. Anyway, carry on.

Warnings
scli.warn("Something happened that wasn't an error that you should be worried about.";
Errors
scli.error("Yeah, something actually went wrong here :(");
Success / OK
scli.ok("This is a message telling you it is all good in the hood!");
scli.success("This is an identical message, just using the word success to make people feel better");

Note: Similar to the log() functions above, these two success functions have identical output.

scli.ok("Success message");
scli.success("Success message");

That's not enough for you, eh? Ugh. Fine.

Extensible configuration options

The configuration file looks a little like this

var config = {
  nameVisible : true,
  app : {
    name : "SuperCLI",
    showName : true
  },
  messages : {
    log : "Log",
    error : " Error",
    success : "Success",
    warning : "Warning",
    ok : "OK"
  }
};

And HERE is how you can make this module work better for you.

Change the application name that shows in log messages

Right now, all messages are prepended with SuperCLI when they are displayed. If you want to set that to your own application name, and I highly recommend that you do, you can run this command:

scli.config.appName("Your App Name Here");

Which will change the output of scli.log("Your log here"); to

[ Your App Name Here: Log ] Your log here
If you want to just hide the name entirely, you can!
scli.config.hideName();

Which will change the output of scli.log("Your log here"); to

[ Log ] Your log here
And if you already hid it but want to bring it back, you can do that too!
scli.config.showName();

Which will change the output of scli.log("Your log here"); back to

[ Your App Name Here: Log ] Your log here
Change the message names!

Want to get crazy and change the default words that are used in console messages? Being a generous guy, I am going to let you do that as well.

scli.config.set({
  messages : {
    log : "LOGGY LOG!",
    error : "You fucked up.",
    success : "Shit went right!",
    warning : "WATCH YO ASS FOO!",
    ok : "Shit went right!"
  }
});

Now, running a basic scli.log("Your log message here"); command (assuming you already changed your application name) will output:

[ Your App Name Here: LOGGY LOG! ] Your log message here

Is that seriously still not enough? YOU are a pain in the ass. Fine.

Directly access color functions using $.

Note: The lowercase functions are regular text, the UPPERCASE functions are the bolded versions

IMPORTANT: Unlike the standard calls, the direct $ color functions only accept a single string as an argument. No objects, no arrays, none of it. Just one single thing that you can put in the center of a string. Sorry.

scli.$.red("All this text will be red");
scli.$.MAGENTA("All this text will be bolded magenta");

Here's the full list of colors and their functions:

ColorLightBold/Bright
Redscli.$.red()scli.$.RED()
Greenscli.$.green()scli.$.GREEN()
Yelloscli.$.yellow()scli.$.YELLOW()
Bluescli.$.blue()scli.$.BLUE()
Magentascli.$.magenta()scli.$.MAGENTA()
Cyanscli.$.cyan()scli.$.CYAN()
Whitescli.$.white()scli.$.WHITE()

Full API Reference

All functions below assume that you have already required SuperCLI as var scli = require('supercli');

FunctionParametersOutput ColorPurpose
scli()AnythingCyanStandard log message
scli.log()AnythingCyanStandard log message
scli.lg()AnythingCyanStandard log message
scli.okAnythingGreenSuccess message
scli.success()AnythingGreenSuccess message
scli.error()AnythingRedError message
scli.warn()AnythingYellowWarning message
scli.config.appName()String: New Name--Sets application name used in output
scli.config.set()Object: New Settings--Changes configuration object. See above!
scli.config.hideName()----Removes application name from future console output
scli.config.showName()----Shows application name in future console output
scli.$.red()String: MessageLight RedLog message without frills in one color
scli.$.RED()String: MessageBright/Bold RedLog message without frills in one color
scli.$.green()String: MessageLight GreenLog message without frills in one color
scli.$.GREEN()String: MessageBright/Bold GreenLog message without frills in one color
scli.$.yellow()String: MessageLight YellowLog message without frills in one color
scli.$.YELLOW()String: MessageBright/Bold YellowLog message without frills in one color
scli.$.blue()String: MessageLight BlueLog message without frills in one color
scli.$.BLUE()String: MessageBright/Bold BlueLog message without frills in one color
scli.$.magenta()String: MessageLight MagentaLog message without frills in one color
scli.$.MAGENTA()String: MessageBright/Bold MagentaLog message without frills in one color
scli.$.cyan()String: MessageLight CyanLog message without frills in one color
scli.$.CYAN()String: MessageBright/Bold CyanLog message without frills in one color
scli.$.white()String: MessageLight WhiteLog message without frills in one color
scli.$.WHITE()String: MessageBright/Bold WhiteLog message without frills in one color
Pierce Moore

Email : me@prex.io
Twitter : @kiapierce

Keywords

FAQs

Package last updated on 22 Jul 2013

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc