1.5.3 • Published 1 month ago

@kawu/console-kit v1.5.3

Weekly downloads
-
License
ISC
Repository
github
Last release
1 month ago

Console-kit

A fast, light weight, minimalist and reliable module to log stuff easly and more understable.

Installation

Use this command to add Console-kit

  npm i @kawu/console-kit

Usage

TS

import { ConsoleKit } from "@kawu/console-kit";
const consoleKit = new ConsoleKit();

JS

const { ConsoleKit } = require("@kawu/console-kit");
const consoleKit = new ConsoleKit();

Logging

When logging what's going on in your application is crucial, I have dedicated functions for every situation.

Example

Example

Comments

consoleKit.comment(CommentOptions);
// CommentOptions

message: string;
timestamp: boolean; // Not required

Check (success)

consoleKit.check(CheckOptions);
// CheckOptions

message: string;
timestamp: boolean; // Not required

Info

consoleKit.info(InfoOptions);
// InfoOptions

message: string;
timestamp: boolean; // Not required

Warn

consoleKit.warn(WarnOptions);
// WarnOptions

message: string;
timestamp: boolean; // Not required

X (error)

consoleKit.x(ErrorOptions);
// ErrorOptions

message: string;
timestamp: boolean; // Not required

Loading

This is kinda usefull to tell that your terminal is doing background stuff.

Example

Start loader

consoleKit.startLoading(StartLoaderOptions);
// StartLoaderOptions

message: string;
timestamp: boolean; // Not required

Stop loader

consoleKit.stopLoading(StopLoaderOptions);
// StopLoaderOptions

clearLine: boolean; // Remove the loading line if true

Progress Bar

Like the loading but we know when the loading will finish.

Example

Start progress bar

consoleKit.startProgress(StartProgressOptions);
// StartProgressOptions

message: string;
percentage: number;
timestamp: boolean; // Not required

Edit the actual progress bar

consoleKit.editProgress(EditProgressOptions);
// EditProgressOptions

percentage: number;
message: string;

End progress bar

consoleKit.endProgress(EndProgressOptions);
// EndProgressOptions

clearLine: boolean; // Remove the progress bar line if true

Prompt

If your user need to give you data, then the prompt is a good way to go.

Example

Usage

consoleKit.prompt(PromptOptions);
// PromptOptions

message: string;
character: string; // Not required -- If you wish to replace "?", put your own icon here

Output

string;

YesNo

It's like prompt but for boolean values.

Example

Usage

consoleKit.yesno(YesNoOptions);
// YesNoOptions

message: string;
defaultValue: boolean; // true = yes | false = no

Output

If the default value is false and the user send for example lol then the output will be false because he didn't put no/n or yes/y.

boolean;

Select

You have a list and your user have to select an item inside a list, then this will do the job.

Example

consoleKit.select(SelectOptions);
values: Array<string>;
defaultValueIndex: number; // Not required -- Index number of the values array
selectedText: string; // Not required -- Custom the "[ • ]" (Item selected)
unselectedText: string; // Not required -- Custom the "[  ]" (Item not selected)
cleanafter: boolean; // Not required -- Remove the selection of the terminal when user finished
1.5.3

1 month ago

1.5.2

1 month ago

1.2.5

3 months ago

1.1.0

5 months ago

1.1.5

5 months ago

1.0.1

5 months ago

1.0.0

5 months ago

0.0.9

5 months ago

0.0.8

5 months ago

0.0.7

5 months ago

0.0.6

5 months ago

0.0.5

5 months ago

0.0.4

5 months ago

0.0.3

5 months ago

0.0.2

5 months ago

0.0.1

5 months ago