diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..d7c2d60
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,19 @@
+# dependencies
+/node_modules
+
+# IDE
+/.idea
+/.awcache
+/.vscode
+
+# misc
+npm-debug.log
+.DS_Store
+
+# tests
+/test
+/coverage
+/.nyc_output
+
+# dist
+dist
\ No newline at end of file
diff --git a/.npmignore b/.npmignore
new file mode 100644
index 0000000..8333d2b
--- /dev/null
+++ b/.npmignore
@@ -0,0 +1,21 @@
+# source
+lib
+tests
+index.ts
+package-lock.json
+tslint.json
+tsconfig.json
+.prettierrc
+
+# github
+cover.png
+.github
+CONTRIBUTING.md
+CODE_OF_CONDUCT.md
+README.md
+
+# misc
+.commitlintrc.json
+.release-it.json
+.eslintignore
+.eslintrc.js
\ No newline at end of file
diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md
new file mode 100644
index 0000000..1ba9c98
--- /dev/null
+++ b/CODE_OF_CONDUCT.md
@@ -0,0 +1,76 @@
+# Contributor Covenant Code of Conduct
+
+## Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, sex characteristics, gender identity and expression,
+level of experience, education, socio-economic status, nationality, personal
+appearance, race, religion, or sexual identity and orientation.
+
+## Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+ advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+## Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+## Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+## Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at vinayaksarawagi25@gmail.com. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+## Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
+
+[homepage]: https://www.contributor-covenant.org
+
+For answers to common questions about this code of conduct, see
+https://www.contributor-covenant.org/faq
diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md
new file mode 100644
index 0000000..74f341c
--- /dev/null
+++ b/CONTRIBUTING.md
@@ -0,0 +1,90 @@
+# Contributing
+
+When contributing to this repository, please first discuss the change you wish to make via issue,
+email, or any other method with the owners of this repository before making a change.
+
+Please note we have a code of conduct, please follow it in all your interactions with the project.
+
+## Pull Request Process
+
+1. Ensure any install or build dependencies are removed before the end of the layer when doing a
+ build.
+2. Update the README.md with details of changes to the interface, this includes new environment
+ variables, exposed ports, useful file locations and container parameters.
+3. You may merge the Pull Request in once you have the sign-off of two other developers, or if you
+ do not have permission to do that, you may request the second reviewer to merge it for you.
+
+## Code of Conduct
+
+### Our Pledge
+
+In the interest of fostering an open and welcoming environment, we as
+contributors and maintainers pledge to making participation in our project and
+our community a harassment-free experience for everyone, regardless of age, body
+size, disability, ethnicity, gender identity and expression, level of experience,
+nationality, personal appearance, race, religion, or sexual identity and
+orientation.
+
+### Our Standards
+
+Examples of behavior that contributes to creating a positive environment
+include:
+
+* Using welcoming and inclusive language
+* Being respectful of differing viewpoints and experiences
+* Gracefully accepting constructive criticism
+* Focusing on what is best for the community
+* Showing empathy towards other community members
+
+Examples of unacceptable behavior by participants include:
+
+* The use of sexualized language or imagery and unwelcome sexual attention or
+advances
+* Trolling, insulting/derogatory comments, and personal or political attacks
+* Public or private harassment
+* Publishing others' private information, such as a physical or electronic
+ address, without explicit permission
+* Other conduct which could reasonably be considered inappropriate in a
+ professional setting
+
+### Our Responsibilities
+
+Project maintainers are responsible for clarifying the standards of acceptable
+behavior and are expected to take appropriate and fair corrective action in
+response to any instances of unacceptable behavior.
+
+Project maintainers have the right and responsibility to remove, edit, or
+reject comments, commits, code, wiki edits, issues, and other contributions
+that are not aligned to this Code of Conduct, or to ban temporarily or
+permanently any contributor for other behaviors that they deem inappropriate,
+threatening, offensive, or harmful.
+
+### Scope
+
+This Code of Conduct applies both within project spaces and in public spaces
+when an individual is representing the project or its community. Examples of
+representing a project or community include using an official project e-mail
+address, posting via an official social media account, or acting as an appointed
+representative at an online or offline event. Representation of a project may be
+further defined and clarified by project maintainers.
+
+### Enforcement
+
+Instances of abusive, harassing, or otherwise unacceptable behavior may be
+reported by contacting the project team at [INSERT EMAIL ADDRESS]. All
+complaints will be reviewed and investigated and will result in a response that
+is deemed necessary and appropriate to the circumstances. The project team is
+obligated to maintain confidentiality with regard to the reporter of an incident.
+Further details of specific enforcement policies may be posted separately.
+
+Project maintainers who do not follow or enforce the Code of Conduct in good
+faith may face temporary or permanent repercussions as determined by other
+members of the project's leadership.
+
+### Attribution
+
+This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
+available at [http://contributor-covenant.org/version/1/4][version]
+
+[homepage]: http://contributor-covenant.org
+[version]: http://contributor-covenant.org/version/1/4/
diff --git a/LICENSE.MD b/LICENSE.MD
new file mode 100644
index 0000000..5116b21
--- /dev/null
+++ b/LICENSE.MD
@@ -0,0 +1,21 @@
+# The MIT License (MIT)
+
+Copyright © 2020 [SquareBoat](https://squareboat.com)
+
+> Permission is hereby granted, free of charge, to any person obtaining a copy
+> of this software and associated documentation files (the "Software"), to deal
+> in the Software without restriction, including without limitation the rights
+> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+> copies of the Software, and to permit persons to whom the Software is
+> furnished to do so, subject to the following conditions:
+>
+> The above copyright notice and this permission notice shall be included in
+> all copies or substantial portions of the Software.
+>
+> THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+> THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..a47c4ec
--- /dev/null
+++ b/README.md
@@ -0,0 +1,29 @@
+# Nestjs Console
+
+Create beautiful CLI commands in your application. A simple NestJS CLI module, comes packaged with utilities.
+
+## Features
+
+- *__Quick Setup__* - Quickly setup and configure your application
+
+- *__Utilities__* - Comes packed with utilities to let you easily interact with console.
+
+- *__Beautiful Commands__* - Creating a beautiful command is as easy as creating a simple injector.
+
+## Documentation
+
+To read the complete documentation, [click here](https://opensource.squareboat.com/nest-console/).
+
+## Contributing
+
+To know about contributing to this package, read the guidelines [here](./CONTRIBUTING.md)
+
+## About Us
+
+We are a bunch of dreamers, designers, and futurists. We are high on collaboration, low on ego, and take our happy hours seriously. We'd love to hear more about your product. Let's talk and turn your great ideas into something even greater! We have something in store for everyone. [☎️ 📧 Connect with us!](https://squareboat.com/contact)
+
+## License
+
+The MIT License. Please see License File for more information. Copyright © 2020 SquareBoat.
+
+Made with ❤️ by [Squareboat](https://squareboat.com)
diff --git a/README.npm.md b/README.npm.md
new file mode 100644
index 0000000..8abd6be
--- /dev/null
+++ b/README.npm.md
@@ -0,0 +1,27 @@
+
Integrate event listeners easily inside your nestjs application
+
+Custom implementation of event listeners. Now, run your decoupled code beautifully without ever bothering of shaking the main code.
+
+## Features
+
+- *__Quick Setup__* - Quickly setup and configure your application
+
+- *__Loose coupling__* - Run codes in parallel accross modules, so that you never need to tightly couple the code.
+
+## Documentation
+
+To read the complete documentation, [click here](https://opensource.squareboat.com/nest-events/).
+
+## Contributing
+To know about contributing to this package, read the guidelines [here](./CONTRIBUTING.md)
+
+
+## About Us
+
+We are a bunch of dreamers, designers, and futurists. We are high on collaboration, low on ego, and take our happy hours seriously. We'd love to hear more about your product. Let's talk and turn your great ideas into something even greater! We have something in store for everyone. [☎️ 📧 Connect with us!](https://squareboat.com/contact)
+
+## License
+
+The MIT License. Please see License File for more information. Copyright © 2020 SquareBoat.
+
+Made with ❤️ by [Squareboat](https://squareboat.com)
diff --git a/cover.png b/cover.png
new file mode 100644
index 0000000..f6f88d4
Binary files /dev/null and b/cover.png differ
diff --git a/lib/commands/index.ts b/lib/commands/index.ts
new file mode 100644
index 0000000..967de55
--- /dev/null
+++ b/lib/commands/index.ts
@@ -0,0 +1 @@
+export * from "./listCommands";
diff --git a/lib/commands/listCommands.ts b/lib/commands/listCommands.ts
new file mode 100644
index 0000000..0f832b2
--- /dev/null
+++ b/lib/commands/listCommands.ts
@@ -0,0 +1,26 @@
+import * as chalk from "chalk";
+import { _cli } from "../helpers";
+import { Command } from "../decorators";
+import { CommandMeta } from "../metadata";
+import { Injectable } from "@nestjs/common";
+import { CommandArguments } from "../interfaces";
+
+@Injectable()
+@Command("list", {
+ desc: "Command to list all the commands",
+})
+export class ListCommands {
+ public async handle(options: CommandArguments): Promise {
+ const commands = CommandMeta.getAllCommands();
+ const list = [];
+ for (const key in commands) {
+ const options = commands[key].options;
+ list.push({
+ command: chalk.greenBright.bold(key),
+ description: options.desc,
+ });
+ }
+
+ _cli.table(list);
+ }
+}
diff --git a/lib/constants.ts b/lib/constants.ts
new file mode 100644
index 0000000..8b3ff73
--- /dev/null
+++ b/lib/constants.ts
@@ -0,0 +1,2 @@
+export const COMMAND_NAME = "__commandname__";
+export const COMMAND_OPTIONS = "__commandoptions__";
diff --git a/lib/decorators.ts b/lib/decorators.ts
new file mode 100644
index 0000000..102c21b
--- /dev/null
+++ b/lib/decorators.ts
@@ -0,0 +1,25 @@
+import "reflect-metadata";
+import { COMMAND_NAME, COMMAND_OPTIONS } from "./constants";
+import { CommandOptions } from "./interfaces";
+
+/**
+ * Command decorator function to add a new command to CommandMeta class
+ * @param command string
+ * @param options Record
+ */
+export function Command(command: string, options?: CommandOptions) {
+ options = options || ({} as CommandOptions);
+ return function (...args: string[] | any[]) {
+ switch (args.length) {
+ case 1:
+ Reflect.defineMetadata(COMMAND_NAME, command, args[0]);
+ Reflect.defineMetadata(COMMAND_OPTIONS, options, args[0]);
+ break;
+
+ case 3:
+ Reflect.defineMetadata(COMMAND_NAME, command, args[0], args[1]);
+ Reflect.defineMetadata(COMMAND_OPTIONS, options, args[0], args[1]);
+ break;
+ }
+ };
+}
diff --git a/lib/explorer.ts b/lib/explorer.ts
new file mode 100644
index 0000000..61c3033
--- /dev/null
+++ b/lib/explorer.ts
@@ -0,0 +1,55 @@
+import { Injectable } from "@nestjs/common";
+import { DiscoveryService, MetadataScanner } from "@nestjs/core";
+import { COMMAND_NAME, COMMAND_OPTIONS } from "./constants";
+import { CommandMeta } from "./metadata";
+
+@Injectable()
+export class ConsoleExplorer {
+ constructor(
+ private readonly discovery: DiscoveryService,
+ private readonly metadataScanner: MetadataScanner
+ ) {}
+
+ onModuleInit() {
+ const wrappers = this.discovery.getProviders();
+ wrappers.forEach((w) => {
+ const { instance } = w;
+ if (
+ !instance ||
+ typeof instance === "string" ||
+ !Object.getPrototypeOf(instance)
+ ) {
+ return;
+ }
+
+ this.metadataScanner.scanFromPrototype(
+ instance,
+ Object.getPrototypeOf(instance),
+ (key: string) => this.lookupConsoleCommands(instance, key)
+ );
+ });
+ }
+
+ lookupConsoleCommands(instance: Record, key: string) {
+ const methodRef = instance[key];
+ const hasCommandMeta = Reflect.hasMetadata(COMMAND_NAME, instance, key);
+ const isClassConsoleCommand = Reflect.hasMetadata(
+ COMMAND_NAME,
+ instance.constructor
+ );
+
+ if (!hasCommandMeta && !isClassConsoleCommand) return;
+
+ if (isClassConsoleCommand && key != "handle") return;
+
+ const command =
+ Reflect.getMetadata(COMMAND_NAME, instance, key) ||
+ Reflect.getMetadata(COMMAND_NAME, instance.constructor);
+
+ const options =
+ Reflect.getMetadata(COMMAND_OPTIONS, instance, key) ||
+ Reflect.getMetadata(COMMAND_OPTIONS, instance.constructor);
+
+ CommandMeta.setCommand(command, methodRef.bind(instance), options || {});
+ }
+}
diff --git a/lib/helpers.ts b/lib/helpers.ts
new file mode 100644
index 0000000..0a90a4f
--- /dev/null
+++ b/lib/helpers.ts
@@ -0,0 +1,87 @@
+import { Inquirer } from "./inquirer";
+import { Logger } from "./logger";
+
+export const _cli = {
+ /**
+ * Use this method to print an information line
+ * @param msg
+ * @returns void
+ */
+ info: (msg: string, color?: string) => Logger.info(msg, color),
+
+ /**
+ * Use this method to print an error message
+ * @param msg
+ * @returns void
+ */
+ error: (msg: string) => Logger.error(msg),
+
+ /**
+ * Use this method to print a success message
+ * @param msg
+ * @returns void
+ */
+ success: (msg: string) => Logger.success(msg),
+
+ /**
+ * Use this method to print a line.
+ * Prints line half the width of the console
+ * @returns void
+ */
+ line: () => Logger.line(),
+ /**
+ * Use this function to print table in console
+ * @param rows
+ * @param options
+ * @returns void
+ */
+ table: (rows: Record[]) => Logger.table(rows),
+
+ /**
+ * Use this method to ask the client about any input.
+ * @param question
+ * @returns Promise
+ */
+ ask: async (question: string) => Inquirer.ask(question),
+
+ /**
+ * Use this method to let the client select option from given choices
+ * @param question
+ * @param choices
+ * @returns Promise
+ */
+ select: (question: string, choices: string[], multiple = false) =>
+ Inquirer.select(question, choices, multiple),
+
+ /**
+ * Use this method to ask for confirmation from the client
+ * @param question
+ */
+ confirm: (question: string) => Inquirer.confirm(question),
+
+ /**
+ * Use this method to ask for a password/hidden input from the client
+ * @param question
+ * @param mask
+ */
+ password: (question: string, mask = "") => Inquirer.password(question, mask),
+};
+
+/**
+ * Pick all keys except explicitly mentioned from any object
+ *
+ * @param value
+ */
+export function except(
+ obj: Record,
+ keys: Array
+): Record {
+ const _obj = {};
+
+ for (const key of Object.keys(obj)) {
+ if (keys.includes(key)) continue;
+ (_obj as Record)[key] = obj[key];
+ }
+
+ return _obj;
+}
diff --git a/lib/index.ts b/lib/index.ts
new file mode 100644
index 0000000..0ae1ee8
--- /dev/null
+++ b/lib/index.ts
@@ -0,0 +1,10 @@
+export * from "./metadata";
+export * from "./decorators";
+export * from "./logger";
+export * from "./inquirer";
+export * from "./commands";
+export * from "./explorer";
+export * from "./worker";
+export * from "./interfaces";
+export * from "./helpers";
+export * from "./module";
diff --git a/lib/inquirer.ts b/lib/inquirer.ts
new file mode 100644
index 0000000..ee05572
--- /dev/null
+++ b/lib/inquirer.ts
@@ -0,0 +1,56 @@
+import inquirer = require('inquirer');
+
+export class Inquirer {
+ /**
+ * Use this method to ask the client about any input.
+ * @param question
+ * @returns Promise
+ */
+ static async ask(question: string): Promise {
+ const answers = await inquirer.prompt([
+ { name: 'question', message: question },
+ ]);
+ return answers.question;
+ }
+
+ /**
+ * Use this method to ask for confirmation from the client
+ * @param question
+ */
+ static async confirm(message: string): Promise {
+ const answer = await inquirer.prompt([
+ { name: 'confirm_once', message, type: 'confirm' },
+ ]);
+
+ return answer.confirm_once;
+ }
+
+ /**
+ * Use this method to let the client select option from given choices
+ * @param question
+ * @param choices
+ * @returns Promise
+ */
+ static async select(
+ message: string,
+ choices: string[],
+ multiple = false,
+ ): Promise {
+ const type = multiple ? 'checkbox' : 'list';
+ const name = 'command';
+ const answers = await inquirer.prompt([{ type, name, message, choices }]);
+ return answers.command;
+ }
+
+ /**
+ * Use this method to ask for a password/hidden input from the client
+ * @param question
+ * @param mask
+ */
+ static async password(message: string, mask = ''): Promise {
+ const type = 'password',
+ name = 'command';
+ const answers = await inquirer.prompt([{ type, name, message, mask }]);
+ return answers[name];
+ }
+}
diff --git a/lib/interfaces/commandOptions.ts b/lib/interfaces/commandOptions.ts
new file mode 100644
index 0000000..52e98ed
--- /dev/null
+++ b/lib/interfaces/commandOptions.ts
@@ -0,0 +1,14 @@
+export interface Option {
+ desc?: string;
+ alias?: string;
+ req?: boolean;
+}
+
+export interface CommandArguments {
+ [key: string]: Option;
+}
+
+export interface CommandOptions {
+ desc?: string;
+ args?: CommandArguments;
+}
diff --git a/lib/interfaces/index.ts b/lib/interfaces/index.ts
new file mode 100644
index 0000000..6ba893e
--- /dev/null
+++ b/lib/interfaces/index.ts
@@ -0,0 +1 @@
+export * from "./commandOptions";
diff --git a/lib/logger.ts b/lib/logger.ts
new file mode 100644
index 0000000..fde5fa8
--- /dev/null
+++ b/lib/logger.ts
@@ -0,0 +1,74 @@
+import * as chalk from "chalk";
+// import { Table } from 'console-table-printer';
+import Table = require("cli-table3");
+
+export class Logger {
+ /**
+ * Use this method to print an information line
+ * @param msg
+ * @returns void
+ */
+ public static info(msg: string, color?: string): void {
+ color = color || "cyan";
+ this.print(msg, color);
+ }
+
+ /**
+ * Use this method to print an error message
+ * @param msg
+ * @returns void
+ */
+ static error(msg: string): void {
+ console.log(chalk.bgRed.bold(msg));
+ }
+
+ /**
+ * Use this method to print a line.
+ * Prints line half the width of the console
+ * @returns void
+ */
+ static line(): void {
+ console.log(chalk.bgGray("-".repeat(process.stdout.columns / 2)));
+ }
+
+ /**
+ * Use this method to print a success message
+ * @param msg
+ * @returns void
+ */
+ static success(msg: string) {
+ this.print(msg, "green");
+ }
+
+ /**
+ * Use this function to print table in console
+ * @param rows
+ * @param options
+ * @returns void
+ */
+ static table(rows: Record[]): void {
+ let columns: string[] = [];
+ for (const row of rows) {
+ columns = columns.concat(Object.keys(row));
+ }
+ columns = [...new Set(columns)];
+ const uniqueCols = [];
+ for (const col of columns) {
+ uniqueCols.push(
+ chalk.cyan.bold(col.charAt(0).toUpperCase() + col.slice(1))
+ );
+ }
+
+ const pRows: any[] = [];
+ rows.forEach((r) => pRows.push(Object.values(r)));
+
+ const p = new Table({ head: uniqueCols });
+ p.push(...pRows);
+
+ console.log(p.toString());
+ }
+
+ static print(msg: string, color: string) {
+ console.log((chalk as Record)[color](msg));
+ }
+}
diff --git a/lib/metadata.ts b/lib/metadata.ts
new file mode 100644
index 0000000..d58817c
--- /dev/null
+++ b/lib/metadata.ts
@@ -0,0 +1,54 @@
+import { CommandOptions } from './interfaces';
+
+export class CommandMeta {
+ private static commands: Record = {};
+
+ /**
+ * Add a new command to the command meta
+ * @param command string
+ * @param target Function
+ * @param options Options
+ *
+ * @returns void
+ */
+ static setCommand(
+ command: string,
+ target: Function,
+ options?: CommandOptions,
+ ): void {
+ CommandMeta.commands[command] = { target, options };
+ return;
+ }
+
+ /**
+ * Get all commands along with their stored payload
+ *
+ * @returns Record
+ */
+ static getAllCommands(): Record {
+ return CommandMeta.commands;
+ }
+
+ /**
+ * Get the specified command
+ * @param command string
+ *
+ * @returns Function|null
+ */
+ static getCommand(command: string): Record | null {
+ if (!command) return null;
+ const obj = CommandMeta.commands[command];
+ return obj || null;
+ }
+
+ /**
+ * Get target for the specified command
+ * @param command string
+ *
+ * @returns Function|null
+ */
+ static getTarget(command: string): Function | null {
+ const obj = CommandMeta.commands[command];
+ return obj ? obj.target : null;
+ }
+}
diff --git a/lib/module.ts b/lib/module.ts
new file mode 100644
index 0000000..07446cb
--- /dev/null
+++ b/lib/module.ts
@@ -0,0 +1,36 @@
+import { DynamicModule, Global, Module } from "@nestjs/common";
+import { DiscoveryModule } from "@nestjs/core";
+import { ListCommands } from "./commands";
+import { ConsoleExplorer } from "./explorer";
+
+@Global()
+@Module({
+ imports: [DiscoveryModule],
+ providers: [ConsoleExplorer, ListCommands],
+})
+export class ConsoleModule {
+ /**
+ * Register options
+ * @param options
+ */
+ static register(): DynamicModule {
+ return {
+ global: true,
+ module: ConsoleModule,
+ imports: [DiscoveryModule],
+ providers: [ListCommands, ConsoleExplorer],
+ };
+ }
+
+ /**
+ * Register Async Options
+ */
+ static registerAsync(): DynamicModule {
+ return {
+ global: true,
+ module: ConsoleModule,
+ imports: [DiscoveryModule],
+ providers: [ConsoleExplorer],
+ };
+ }
+}
diff --git a/lib/worker.ts b/lib/worker.ts
new file mode 100644
index 0000000..0f8c89e
--- /dev/null
+++ b/lib/worker.ts
@@ -0,0 +1,23 @@
+import { except, _cli } from './helpers';
+
+export class CommandRunner {
+ static async handle(
+ command: Record,
+ args: Record,
+ ): Promise {
+ const options = command.options.args || {};
+ const requiredOptions = Object.keys(options).filter((k) => options[k].req);
+ const noInputFound = [];
+ for (const option of requiredOptions) {
+ if (!args[option]) noInputFound.push(option);
+ }
+
+ if (noInputFound.length) {
+ _cli.error(` Missing arguments: ${noInputFound.join(', ')} `);
+ return;
+ }
+
+ args = except(args, ['_', '$0', 'command']);
+ command.target(args);
+ }
+}
diff --git a/package-lock.json b/package-lock.json
new file mode 100644
index 0000000..001ad02
--- /dev/null
+++ b/package-lock.json
@@ -0,0 +1,730 @@
+{
+ "name": "@squareboat/nest-console",
+ "version": "0.0.5",
+ "lockfileVersion": 1,
+ "requires": true,
+ "dependencies": {
+ "@nestjs/common": {
+ "version": "7.4.4",
+ "resolved": "https://registry.npmjs.org/@nestjs/common/-/common-7.4.4.tgz",
+ "integrity": "sha512-Cj94FJrnLcAU4URJrRmnsHRODZPJpX+EKKJ/Or9qvL9ULQwRWYmFcGQYaJ0nVV0hSBjn/jaAV1Cgqw74uk21KA==",
+ "dev": true,
+ "requires": {
+ "axios": "0.20.0",
+ "cli-color": "2.0.0",
+ "iterare": "1.2.1",
+ "tslib": "2.0.1",
+ "uuid": "8.3.0"
+ },
+ "dependencies": {
+ "uuid": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz",
+ "integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==",
+ "dev": true
+ }
+ }
+ },
+ "@nestjs/core": {
+ "version": "7.4.4",
+ "resolved": "https://registry.npmjs.org/@nestjs/core/-/core-7.4.4.tgz",
+ "integrity": "sha512-e3iID6s0JIaWDlZMIO+gkk5KDwHW+VUexvZOKXbTjtsBidtusbiT4JLr4ODkj8y3QSfQN9vouY9hWfwwQrxa/Q==",
+ "dev": true,
+ "requires": {
+ "@nuxtjs/opencollective": "0.2.2",
+ "fast-safe-stringify": "2.0.7",
+ "iterare": "1.2.1",
+ "object-hash": "2.0.3",
+ "path-to-regexp": "3.2.0",
+ "tslib": "2.0.1",
+ "uuid": "8.3.0"
+ },
+ "dependencies": {
+ "uuid": {
+ "version": "8.3.0",
+ "resolved": "https://registry.npmjs.org/uuid/-/uuid-8.3.0.tgz",
+ "integrity": "sha512-fX6Z5o4m6XsXBdli9g7DtWgAx+osMsRRZFKma1mIUsLCz6vRvv+pz5VNbyu9UEDzpMWulZfvpgb/cmDXVulYFQ==",
+ "dev": true
+ }
+ }
+ },
+ "@nuxtjs/opencollective": {
+ "version": "0.2.2",
+ "resolved": "https://registry.npmjs.org/@nuxtjs/opencollective/-/opencollective-0.2.2.tgz",
+ "integrity": "sha512-69gFVDs7mJfNjv9Zs5DFVD+pvBW+k1TaHSOqUWqAyTTfLcKI/EMYQgvEvziRd+zAFtUOoye6MfWh0qvinGISPw==",
+ "dev": true,
+ "requires": {
+ "chalk": "^2.4.1",
+ "consola": "^2.3.0",
+ "node-fetch": "^2.3.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "3.2.1",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-3.2.1.tgz",
+ "integrity": "sha512-VT0ZI6kZRdTh8YyJw3SMbYm/u+NqfsAxEpWO0Pf9sq8/e94WxxOpPKx9FR1FlyCtOVDNOQ+8ntlqFxiRc+r5qA==",
+ "dev": true,
+ "requires": {
+ "color-convert": "^1.9.0"
+ }
+ },
+ "chalk": {
+ "version": "2.4.2",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-2.4.2.tgz",
+ "integrity": "sha512-Mti+f9lpJNcwF4tWV8/OrTTtF1gZi+f8FqlyAdouralcFWFQWF2+NgCHShjkCb+IFBLq9buZwE1xckQU4peSuQ==",
+ "dev": true,
+ "requires": {
+ "ansi-styles": "^3.2.1",
+ "escape-string-regexp": "^1.0.5",
+ "supports-color": "^5.3.0"
+ }
+ },
+ "color-convert": {
+ "version": "1.9.3",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-1.9.3.tgz",
+ "integrity": "sha512-QfAUtd+vFdAtFQcC8CCyYt1fYWxSqAiK2cSD6zDB8N3cpsEBAvRxp9zOGg6G/SHHJYAT88/az/IuDGALsNVbGg==",
+ "dev": true,
+ "requires": {
+ "color-name": "1.1.3"
+ }
+ },
+ "color-name": {
+ "version": "1.1.3",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
+ "integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
+ "dev": true
+ },
+ "has-flag": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-3.0.0.tgz",
+ "integrity": "sha1-tdRU3CGZriJWmfNGfloH87lVuv0=",
+ "dev": true
+ },
+ "supports-color": {
+ "version": "5.5.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-5.5.0.tgz",
+ "integrity": "sha512-QjVjwdXIt408MIiAqCX4oUKsgU2EqAGzs2Ppkm4aQYbjm+ZEWEcW4SfFNTr4uMNZma0ey4f5lgLrkB0aX0QMow==",
+ "dev": true,
+ "requires": {
+ "has-flag": "^3.0.0"
+ }
+ }
+ }
+ },
+ "@types/chalk": {
+ "version": "2.2.0",
+ "resolved": "https://registry.npmjs.org/@types/chalk/-/chalk-2.2.0.tgz",
+ "integrity": "sha512-1zzPV9FDe1I/WHhRkf9SNgqtRJWZqrBWgu7JGveuHmmyR9CnAPCie2N/x+iHrgnpYBIcCJWHBoMRv2TRWktsvw==",
+ "dev": true,
+ "requires": {
+ "chalk": "*"
+ }
+ },
+ "@types/inquirer": {
+ "version": "7.3.1",
+ "resolved": "https://registry.npmjs.org/@types/inquirer/-/inquirer-7.3.1.tgz",
+ "integrity": "sha512-osD38QVIfcdgsPCT0V3lD7eH0OFurX71Jft18bZrsVQWVRt6TuxRzlr0GJLrxoHZR2V5ph7/qP8se/dcnI7o0g==",
+ "dev": true,
+ "requires": {
+ "@types/through": "*",
+ "rxjs": "^6.4.0"
+ }
+ },
+ "@types/node": {
+ "version": "14.14.10",
+ "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.10.tgz",
+ "integrity": "sha512-J32dgx2hw8vXrSbu4ZlVhn1Nm3GbeCFNw2FWL8S5QKucHGY0cyNwjdQdO+KMBZ4wpmC7KhLCiNsdk1RFRIYUQQ==",
+ "dev": true
+ },
+ "@types/through": {
+ "version": "0.0.30",
+ "resolved": "https://registry.npmjs.org/@types/through/-/through-0.0.30.tgz",
+ "integrity": "sha512-FvnCJljyxhPM3gkRgWmxmDZyAQSiBQQWLI0A0VFL0K7W1oRUrPJSqNO0NvTnLkBcotdlp3lKvaT0JrnyRDkzOg==",
+ "dev": true,
+ "requires": {
+ "@types/node": "*"
+ }
+ },
+ "@types/yargs": {
+ "version": "15.0.11",
+ "resolved": "https://registry.npmjs.org/@types/yargs/-/yargs-15.0.11.tgz",
+ "integrity": "sha512-jfcNBxHFYJ4nPIacsi3woz1+kvUO6s1CyeEhtnDHBjHUMNj5UlW2GynmnSgiJJEdNg9yW5C8lfoNRZrHGv5EqA==",
+ "dev": true,
+ "requires": {
+ "@types/yargs-parser": "*"
+ }
+ },
+ "@types/yargs-parser": {
+ "version": "15.0.0",
+ "resolved": "https://registry.npmjs.org/@types/yargs-parser/-/yargs-parser-15.0.0.tgz",
+ "integrity": "sha512-FA/BWv8t8ZWJ+gEOnLLd8ygxH/2UFbAvgEonyfN6yWGLKc7zVjbpl2Y4CTjid9h2RfgPP6SEt6uHwEOply00yw==",
+ "dev": true
+ },
+ "ansi-escapes": {
+ "version": "4.3.1",
+ "resolved": "https://registry.npmjs.org/ansi-escapes/-/ansi-escapes-4.3.1.tgz",
+ "integrity": "sha512-JWF7ocqNrp8u9oqpgV+wH5ftbt+cfvv+PTjOvKLT3AdYly/LmORARfEVT1iyjwN+4MqE5UmVKoAdIBqeoCHgLA==",
+ "requires": {
+ "type-fest": "^0.11.0"
+ }
+ },
+ "ansi-regex": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-2.1.1.tgz",
+ "integrity": "sha1-w7M6te42DYbg5ijwRorn7yfWVN8=",
+ "dev": true
+ },
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "axios": {
+ "version": "0.20.0",
+ "resolved": "https://registry.npmjs.org/axios/-/axios-0.20.0.tgz",
+ "integrity": "sha512-ANA4rr2BDcmmAQLOKft2fufrtuvlqR+cXNNinUmvfeSNCOF98PZL+7M/v1zIdGo7OLjEA9J2gXJL+j4zGsl0bA==",
+ "dev": true,
+ "requires": {
+ "follow-redirects": "^1.10.0"
+ }
+ },
+ "chalk": {
+ "version": "4.1.0",
+ "resolved": "https://registry.npmjs.org/chalk/-/chalk-4.1.0.tgz",
+ "integrity": "sha512-qwx12AxXe2Q5xQ43Ac//I6v5aXTipYrSESdOgzrN+9XjgEpyjpKuvSGaN4qE93f7TQTlerQQ8S+EQ0EyDoVL1A==",
+ "requires": {
+ "ansi-styles": "^4.1.0",
+ "supports-color": "^7.1.0"
+ }
+ },
+ "chardet": {
+ "version": "0.7.0",
+ "resolved": "https://registry.npmjs.org/chardet/-/chardet-0.7.0.tgz",
+ "integrity": "sha512-mT8iDcrh03qDGRRmoA2hmBJnxpllMR+0/0qlzjqZES6NdiWDcZkCNAk4rPFZ9Q85r27unkiNNg8ZOiwZXBHwcA=="
+ },
+ "cli-color": {
+ "version": "2.0.0",
+ "resolved": "https://registry.npmjs.org/cli-color/-/cli-color-2.0.0.tgz",
+ "integrity": "sha512-a0VZ8LeraW0jTuCkuAGMNufareGHhyZU9z8OGsW0gXd1hZGi1SRuNRXdbGkraBBKnhyUhyebFWnRbp+dIn0f0A==",
+ "dev": true,
+ "requires": {
+ "ansi-regex": "^2.1.1",
+ "d": "^1.0.1",
+ "es5-ext": "^0.10.51",
+ "es6-iterator": "^2.0.3",
+ "memoizee": "^0.4.14",
+ "timers-ext": "^0.1.7"
+ }
+ },
+ "cli-cursor": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/cli-cursor/-/cli-cursor-3.1.0.tgz",
+ "integrity": "sha512-I/zHAwsKf9FqGoXM4WWRACob9+SNukZTd94DWF57E4toouRulbCxcUh6RKUEOQlYTHJnzkPMySvPNaaSLNfLZw==",
+ "requires": {
+ "restore-cursor": "^3.1.0"
+ }
+ },
+ "cli-table3": {
+ "version": "0.6.0",
+ "resolved": "https://registry.npmjs.org/cli-table3/-/cli-table3-0.6.0.tgz",
+ "integrity": "sha512-gnB85c3MGC7Nm9I/FkiasNBOKjOiO1RNuXXarQms37q4QMpWdlbBgD/VnOStA2faG1dpXMv31RFApjX1/QdgWQ==",
+ "requires": {
+ "colors": "^1.1.2",
+ "object-assign": "^4.1.0",
+ "string-width": "^4.2.0"
+ }
+ },
+ "cli-width": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/cli-width/-/cli-width-3.0.0.tgz",
+ "integrity": "sha512-FxqpkPPwu1HjuN93Omfm4h8uIanXofW0RxVEW3k5RKx+mJJYSthzNhp32Kzxxy3YAEZ/Dc/EWN1vZRY0+kOhbw=="
+ },
+ "cliui": {
+ "version": "7.0.4",
+ "resolved": "https://registry.npmjs.org/cliui/-/cliui-7.0.4.tgz",
+ "integrity": "sha512-OcRE68cOsVMXp1Yvonl/fzkQOyjLSu/8bhPDfQt0e0/Eb283TKP20Fs2MqoPsr9SwA595rRCA+QMzYc9nBP+JQ==",
+ "requires": {
+ "string-width": "^4.2.0",
+ "strip-ansi": "^6.0.0",
+ "wrap-ansi": "^7.0.0"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
+ },
+ "colors": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/colors/-/colors-1.4.0.tgz",
+ "integrity": "sha512-a+UqTh4kgZg/SlGvfbzDHpgRu7AAQOmmqRHJnxhRZICKFUT91brVhNNt58CMWU9PsBbv3PDCZUHbVxuDiH2mtA==",
+ "optional": true
+ },
+ "consola": {
+ "version": "2.15.0",
+ "resolved": "https://registry.npmjs.org/consola/-/consola-2.15.0.tgz",
+ "integrity": "sha512-vlcSGgdYS26mPf7qNi+dCisbhiyDnrN1zaRbw3CSuc2wGOMEGGPsp46PdRG5gqXwgtJfjxDkxRNAgRPr1B77vQ==",
+ "dev": true
+ },
+ "d": {
+ "version": "1.0.1",
+ "resolved": "https://registry.npmjs.org/d/-/d-1.0.1.tgz",
+ "integrity": "sha512-m62ShEObQ39CfralilEQRjH6oAMtNCV1xJyEx5LpRYUVN+EviphDgUc/F3hnYbADmkiNs67Y+3ylmlG7Lnu+FA==",
+ "dev": true,
+ "requires": {
+ "es5-ext": "^0.10.50",
+ "type": "^1.0.1"
+ }
+ },
+ "emoji-regex": {
+ "version": "8.0.0",
+ "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz",
+ "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A=="
+ },
+ "es5-ext": {
+ "version": "0.10.53",
+ "resolved": "https://registry.npmjs.org/es5-ext/-/es5-ext-0.10.53.tgz",
+ "integrity": "sha512-Xs2Stw6NiNHWypzRTY1MtaG/uJlwCk8kH81920ma8mvN8Xq1gsfhZvpkImLQArw8AHnv8MT2I45J3c0R8slE+Q==",
+ "dev": true,
+ "requires": {
+ "es6-iterator": "~2.0.3",
+ "es6-symbol": "~3.1.3",
+ "next-tick": "~1.0.0"
+ }
+ },
+ "es6-iterator": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/es6-iterator/-/es6-iterator-2.0.3.tgz",
+ "integrity": "sha1-p96IkUGgWpSwhUQDstCg+/qY87c=",
+ "dev": true,
+ "requires": {
+ "d": "1",
+ "es5-ext": "^0.10.35",
+ "es6-symbol": "^3.1.1"
+ }
+ },
+ "es6-symbol": {
+ "version": "3.1.3",
+ "resolved": "https://registry.npmjs.org/es6-symbol/-/es6-symbol-3.1.3.tgz",
+ "integrity": "sha512-NJ6Yn3FuDinBaBRWl/q5X/s4koRHBrgKAu+yGI6JCBeiu3qrcbJhwT2GeR/EXVfylRk8dpQVJoLEFhK+Mu31NA==",
+ "dev": true,
+ "requires": {
+ "d": "^1.0.1",
+ "ext": "^1.1.2"
+ }
+ },
+ "es6-weak-map": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/es6-weak-map/-/es6-weak-map-2.0.3.tgz",
+ "integrity": "sha512-p5um32HOTO1kP+w7PRnB+5lQ43Z6muuMuIMffvDN8ZB4GcnjLBV6zGStpbASIMk4DCAvEaamhe2zhyCb/QXXsA==",
+ "dev": true,
+ "requires": {
+ "d": "1",
+ "es5-ext": "^0.10.46",
+ "es6-iterator": "^2.0.3",
+ "es6-symbol": "^3.1.1"
+ }
+ },
+ "escalade": {
+ "version": "3.1.1",
+ "resolved": "https://registry.npmjs.org/escalade/-/escalade-3.1.1.tgz",
+ "integrity": "sha512-k0er2gUkLf8O0zKJiAhmkTnJlTvINGv7ygDNPbeIsX/TJjGJZHuh9B2UxbsaEkmlEo9MfhrSzmhIlhRlI2GXnw=="
+ },
+ "escape-string-regexp": {
+ "version": "1.0.5",
+ "resolved": "https://registry.npmjs.org/escape-string-regexp/-/escape-string-regexp-1.0.5.tgz",
+ "integrity": "sha1-G2HAViGQqN/2rjuyzwIAyhMLhtQ="
+ },
+ "event-emitter": {
+ "version": "0.3.5",
+ "resolved": "https://registry.npmjs.org/event-emitter/-/event-emitter-0.3.5.tgz",
+ "integrity": "sha1-34xp7vFkeSPHFXuc6DhAYQsCzDk=",
+ "dev": true,
+ "requires": {
+ "d": "1",
+ "es5-ext": "~0.10.14"
+ }
+ },
+ "ext": {
+ "version": "1.4.0",
+ "resolved": "https://registry.npmjs.org/ext/-/ext-1.4.0.tgz",
+ "integrity": "sha512-Key5NIsUxdqKg3vIsdw9dSuXpPCQ297y6wBjL30edxwPgt2E44WcWBZey/ZvUc6sERLTxKdyCu4gZFmUbk1Q7A==",
+ "dev": true,
+ "requires": {
+ "type": "^2.0.0"
+ },
+ "dependencies": {
+ "type": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/type/-/type-2.1.0.tgz",
+ "integrity": "sha512-G9absDWvhAWCV2gmF1zKud3OyC61nZDwWvBL2DApaVFogI07CprggiQAOOjvp2NRjYWFzPyu7vwtDrQFq8jeSA==",
+ "dev": true
+ }
+ }
+ },
+ "external-editor": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/external-editor/-/external-editor-3.1.0.tgz",
+ "integrity": "sha512-hMQ4CX1p1izmuLYyZqLMO/qGNw10wSv9QDCPfzXfyFrOaCSSoRfqE1Kf1s5an66J5JZC62NewG+mK49jOCtQew==",
+ "requires": {
+ "chardet": "^0.7.0",
+ "iconv-lite": "^0.4.24",
+ "tmp": "^0.0.33"
+ }
+ },
+ "fast-safe-stringify": {
+ "version": "2.0.7",
+ "resolved": "https://registry.npmjs.org/fast-safe-stringify/-/fast-safe-stringify-2.0.7.tgz",
+ "integrity": "sha512-Utm6CdzT+6xsDk2m8S6uL8VHxNwI6Jub+e9NYTcAms28T84pTa25GJQV9j0CY0N1rM8hK4x6grpF2BQf+2qwVA==",
+ "dev": true
+ },
+ "figures": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/figures/-/figures-3.2.0.tgz",
+ "integrity": "sha512-yaduQFRKLXYOGgEn6AZau90j3ggSOyiqXU0F9JZfeXYhNa+Jk4X+s45A2zg5jns87GAFa34BBm2kXw4XpNcbdg==",
+ "requires": {
+ "escape-string-regexp": "^1.0.5"
+ }
+ },
+ "follow-redirects": {
+ "version": "1.13.0",
+ "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.13.0.tgz",
+ "integrity": "sha512-aq6gF1BEKje4a9i9+5jimNFIpq4Q1WiwBToeRK5NvZBd/TRsmW8BsJfOEGkr76TbOyPVD3OVDN910EcUNtRYEA==",
+ "dev": true
+ },
+ "get-caller-file": {
+ "version": "2.0.5",
+ "resolved": "https://registry.npmjs.org/get-caller-file/-/get-caller-file-2.0.5.tgz",
+ "integrity": "sha512-DyFP3BM/3YHTQOCUL/w0OZHR0lpKeGrxotcHWcqNEdnltqFwXVfhEBQ94eIo34AfQpo0rGki4cyIiftY06h2Fg=="
+ },
+ "has-flag": {
+ "version": "4.0.0",
+ "resolved": "https://registry.npmjs.org/has-flag/-/has-flag-4.0.0.tgz",
+ "integrity": "sha512-EykJT/Q1KjTWctppgIAgfSO0tKVuZUjhgMr17kqTumMl6Afv3EISleU7qZUzoXDFTAHTDC4NOoG/ZxU3EvlMPQ=="
+ },
+ "iconv-lite": {
+ "version": "0.4.24",
+ "resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
+ "integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
+ "requires": {
+ "safer-buffer": ">= 2.1.2 < 3"
+ }
+ },
+ "inquirer": {
+ "version": "7.3.3",
+ "resolved": "https://registry.npmjs.org/inquirer/-/inquirer-7.3.3.tgz",
+ "integrity": "sha512-JG3eIAj5V9CwcGvuOmoo6LB9kbAYT8HXffUl6memuszlwDC/qvFAJw49XJ5NROSFNPxp3iQg1GqkFhaY/CR0IA==",
+ "requires": {
+ "ansi-escapes": "^4.2.1",
+ "chalk": "^4.1.0",
+ "cli-cursor": "^3.1.0",
+ "cli-width": "^3.0.0",
+ "external-editor": "^3.0.3",
+ "figures": "^3.0.0",
+ "lodash": "^4.17.19",
+ "mute-stream": "0.0.8",
+ "run-async": "^2.4.0",
+ "rxjs": "^6.6.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0",
+ "through": "^2.3.6"
+ }
+ },
+ "is-fullwidth-code-point": {
+ "version": "3.0.0",
+ "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz",
+ "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg=="
+ },
+ "is-promise": {
+ "version": "2.2.2",
+ "resolved": "https://registry.npmjs.org/is-promise/-/is-promise-2.2.2.tgz",
+ "integrity": "sha512-+lP4/6lKUBfQjZ2pdxThZvLUAafmZb8OAxFb8XXtiQmS35INgr85hdOGoEs124ez1FCnZJt6jau/T+alh58QFQ==",
+ "dev": true
+ },
+ "iterare": {
+ "version": "1.2.1",
+ "resolved": "https://registry.npmjs.org/iterare/-/iterare-1.2.1.tgz",
+ "integrity": "sha512-RKYVTCjAnRthyJes037NX/IiqeidgN1xc3j1RjFfECFp28A1GVwK9nA+i0rJPaHqSZwygLzRnFlzUuHFoWWy+Q==",
+ "dev": true
+ },
+ "lodash": {
+ "version": "4.17.20",
+ "resolved": "https://registry.npmjs.org/lodash/-/lodash-4.17.20.tgz",
+ "integrity": "sha512-PlhdFcillOINfeV7Ni6oF1TAEayyZBoZ8bcshTHqOYJYlrqzRK5hagpagky5o4HfCzzd1TRkXPMFq6cKk9rGmA=="
+ },
+ "lru-queue": {
+ "version": "0.1.0",
+ "resolved": "https://registry.npmjs.org/lru-queue/-/lru-queue-0.1.0.tgz",
+ "integrity": "sha1-Jzi9nw089PhEkMVzbEhpmsYyzaM=",
+ "dev": true,
+ "requires": {
+ "es5-ext": "~0.10.2"
+ }
+ },
+ "memoizee": {
+ "version": "0.4.14",
+ "resolved": "https://registry.npmjs.org/memoizee/-/memoizee-0.4.14.tgz",
+ "integrity": "sha512-/SWFvWegAIYAO4NQMpcX+gcra0yEZu4OntmUdrBaWrJncxOqAziGFlHxc7yjKVK2uu3lpPW27P27wkR82wA8mg==",
+ "dev": true,
+ "requires": {
+ "d": "1",
+ "es5-ext": "^0.10.45",
+ "es6-weak-map": "^2.0.2",
+ "event-emitter": "^0.3.5",
+ "is-promise": "^2.1",
+ "lru-queue": "0.1",
+ "next-tick": "1",
+ "timers-ext": "^0.1.5"
+ }
+ },
+ "mimic-fn": {
+ "version": "2.1.0",
+ "resolved": "https://registry.npmjs.org/mimic-fn/-/mimic-fn-2.1.0.tgz",
+ "integrity": "sha512-OqbOk5oEQeAZ8WXWydlu9HJjz9WVdEIvamMCcXmuqUYjTknH/sqsWvhQ3vgwKFRR1HpjvNBKQ37nbJgYzGqGcg=="
+ },
+ "mute-stream": {
+ "version": "0.0.8",
+ "resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
+ "integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA=="
+ },
+ "next-tick": {
+ "version": "1.0.0",
+ "resolved": "https://registry.npmjs.org/next-tick/-/next-tick-1.0.0.tgz",
+ "integrity": "sha1-yobR/ogoFpsBICCOPchCS524NCw=",
+ "dev": true
+ },
+ "node-fetch": {
+ "version": "2.6.1",
+ "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.1.tgz",
+ "integrity": "sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==",
+ "dev": true
+ },
+ "object-assign": {
+ "version": "4.1.1",
+ "resolved": "https://registry.npmjs.org/object-assign/-/object-assign-4.1.1.tgz",
+ "integrity": "sha1-IQmtx5ZYh8/AXLvUQsrIv7s2CGM="
+ },
+ "object-hash": {
+ "version": "2.0.3",
+ "resolved": "https://registry.npmjs.org/object-hash/-/object-hash-2.0.3.tgz",
+ "integrity": "sha512-JPKn0GMu+Fa3zt3Bmr66JhokJU5BaNBIh4ZeTlaCBzrBsOeXzwcKKAK1tbLiPKgvwmPXsDvvLHoWh5Bm7ofIYg==",
+ "dev": true
+ },
+ "onetime": {
+ "version": "5.1.2",
+ "resolved": "https://registry.npmjs.org/onetime/-/onetime-5.1.2.tgz",
+ "integrity": "sha512-kbpaSSGJTWdAY5KPVeMOKXSrPtr8C8C7wodJbcsd51jRnmD+GZu8Y0VoU6Dm5Z4vWr0Ig/1NKuWRKf7j5aaYSg==",
+ "requires": {
+ "mimic-fn": "^2.1.0"
+ }
+ },
+ "os-tmpdir": {
+ "version": "1.0.2",
+ "resolved": "https://registry.npmjs.org/os-tmpdir/-/os-tmpdir-1.0.2.tgz",
+ "integrity": "sha1-u+Z0BseaqFxc/sdm/lc0VV36EnQ="
+ },
+ "path-to-regexp": {
+ "version": "3.2.0",
+ "resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-3.2.0.tgz",
+ "integrity": "sha512-jczvQbCUS7XmS7o+y1aEO9OBVFeZBQ1MDSEqmO7xSoPgOPoowY/SxLpZ6Vh97/8qHZOteiCKb7gkG9gA2ZUxJA==",
+ "dev": true
+ },
+ "reflect-metadata": {
+ "version": "0.1.13",
+ "resolved": "https://registry.npmjs.org/reflect-metadata/-/reflect-metadata-0.1.13.tgz",
+ "integrity": "sha512-Ts1Y/anZELhSsjMcU605fU9RE4Oi3p5ORujwbIKXfWa+0Zxs510Qrmrce5/Jowq3cHSZSJqBjypxmHarc+vEWg==",
+ "dev": true
+ },
+ "require-directory": {
+ "version": "2.1.1",
+ "resolved": "https://registry.npmjs.org/require-directory/-/require-directory-2.1.1.tgz",
+ "integrity": "sha1-jGStX9MNqxyXbiNE/+f3kqam30I="
+ },
+ "restore-cursor": {
+ "version": "3.1.0",
+ "resolved": "https://registry.npmjs.org/restore-cursor/-/restore-cursor-3.1.0.tgz",
+ "integrity": "sha512-l+sSefzHpj5qimhFSE5a8nufZYAM3sBSVMAPtYkmC+4EH2anSGaEMXSD0izRQbu9nfyQ9y5JrVmp7E8oZrUjvA==",
+ "requires": {
+ "onetime": "^5.1.0",
+ "signal-exit": "^3.0.2"
+ }
+ },
+ "run-async": {
+ "version": "2.4.1",
+ "resolved": "https://registry.npmjs.org/run-async/-/run-async-2.4.1.tgz",
+ "integrity": "sha512-tvVnVv01b8c1RrA6Ep7JkStj85Guv/YrMcwqYQnwjsAS2cTmmPGBBjAjpCW7RrSodNSoE2/qg9O4bceNvUuDgQ=="
+ },
+ "rxjs": {
+ "version": "6.6.3",
+ "resolved": "https://registry.npmjs.org/rxjs/-/rxjs-6.6.3.tgz",
+ "integrity": "sha512-trsQc+xYYXZ3urjOiJOuCOa5N3jAZ3eiSpQB5hIT8zGlL2QfnHLJ2r7GMkBGuIausdJN1OneaI6gQlsqNHHmZQ==",
+ "requires": {
+ "tslib": "^1.9.0"
+ },
+ "dependencies": {
+ "tslib": {
+ "version": "1.14.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-1.14.1.tgz",
+ "integrity": "sha512-Xni35NKzjgMrwevysHTCArtLDpPvye8zV/0E4EyYn43P7/7qvQwPh9BGkHewbMulVntbigmcT7rdX3BNo9wRJg=="
+ }
+ }
+ },
+ "safer-buffer": {
+ "version": "2.1.2",
+ "resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
+ "integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
+ },
+ "signal-exit": {
+ "version": "3.0.3",
+ "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-3.0.3.tgz",
+ "integrity": "sha512-VUJ49FC8U1OxwZLxIbTTrDvLnf/6TDgxZcK8wxR8zs13xpx7xbG60ndBlhNrFi2EMuFRoeDoJO7wthSLq42EjA=="
+ },
+ "string-width": {
+ "version": "4.2.0",
+ "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.0.tgz",
+ "integrity": "sha512-zUz5JD+tgqtuDjMhwIg5uFVV3dtqZ9yQJlZVfq4I01/K5Paj5UHj7VyrQOJvzawSVlKpObApbfD0Ed6yJc+1eg==",
+ "requires": {
+ "emoji-regex": "^8.0.0",
+ "is-fullwidth-code-point": "^3.0.0",
+ "strip-ansi": "^6.0.0"
+ }
+ },
+ "strip-ansi": {
+ "version": "6.0.0",
+ "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.0.tgz",
+ "integrity": "sha512-AuvKTrTfQNYNIctbR1K/YGTR1756GycPsg7b9bdV9Duqur4gv6aKqHXah67Z8ImS7WEz5QVcOtlfW2rZEugt6w==",
+ "requires": {
+ "ansi-regex": "^5.0.0"
+ },
+ "dependencies": {
+ "ansi-regex": {
+ "version": "5.0.0",
+ "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.0.tgz",
+ "integrity": "sha512-bY6fj56OUQ0hU1KjFNDQuJFezqKdrAyFdIevADiqrWHwSlbmBNMHp5ak2f40Pm8JTFyM2mqxkG6ngkHO11f/lg=="
+ }
+ }
+ },
+ "supports-color": {
+ "version": "7.2.0",
+ "resolved": "https://registry.npmjs.org/supports-color/-/supports-color-7.2.0.tgz",
+ "integrity": "sha512-qpCAvRl9stuOHveKsn7HncJRvv501qIacKzQlO/+Lwxc9+0q2wLyv4Dfvt80/DPn2pqOBsJdDiogXGR9+OvwRw==",
+ "requires": {
+ "has-flag": "^4.0.0"
+ }
+ },
+ "through": {
+ "version": "2.3.8",
+ "resolved": "https://registry.npmjs.org/through/-/through-2.3.8.tgz",
+ "integrity": "sha1-DdTJ/6q8NXlgsbckEV1+Doai4fU="
+ },
+ "timers-ext": {
+ "version": "0.1.7",
+ "resolved": "https://registry.npmjs.org/timers-ext/-/timers-ext-0.1.7.tgz",
+ "integrity": "sha512-b85NUNzTSdodShTIbky6ZF02e8STtVVfD+fu4aXXShEELpozH+bCpJLYMPZbsABN2wDH7fJpqIoXxJpzbf0NqQ==",
+ "dev": true,
+ "requires": {
+ "es5-ext": "~0.10.46",
+ "next-tick": "1"
+ }
+ },
+ "tmp": {
+ "version": "0.0.33",
+ "resolved": "https://registry.npmjs.org/tmp/-/tmp-0.0.33.tgz",
+ "integrity": "sha512-jRCJlojKnZ3addtTOjdIqoRuPEKBvNXcGYqzO6zWZX8KfKEpnGY5jfggJQ3EjKuu8D4bJRr0y+cYJFmYbImXGw==",
+ "requires": {
+ "os-tmpdir": "~1.0.2"
+ }
+ },
+ "tslib": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.0.1.tgz",
+ "integrity": "sha512-SgIkNheinmEBgx1IUNirK0TUD4X9yjjBRTqqjggWCU3pUEqIk3/Uwl3yRixYKT6WjQuGiwDv4NomL3wqRCj+CQ==",
+ "dev": true
+ },
+ "type": {
+ "version": "1.2.0",
+ "resolved": "https://registry.npmjs.org/type/-/type-1.2.0.tgz",
+ "integrity": "sha512-+5nt5AAniqsCnu2cEQQdpzCAh33kVx8n0VoFidKpB1dVVLAN/F+bgVOqOJqOnEnrhp222clB5p3vUlD+1QAnfg==",
+ "dev": true
+ },
+ "type-fest": {
+ "version": "0.11.0",
+ "resolved": "https://registry.npmjs.org/type-fest/-/type-fest-0.11.0.tgz",
+ "integrity": "sha512-OdjXJxnCN1AvyLSzeKIgXTXxV+99ZuXl3Hpo9XpJAv9MBcHrrJOQ5kV7ypXOuQie+AmWG25hLbiKdwYTifzcfQ=="
+ },
+ "typescript": {
+ "version": "3.9.7",
+ "resolved": "https://registry.npmjs.org/typescript/-/typescript-3.9.7.tgz",
+ "integrity": "sha512-BLbiRkiBzAwsjut4x/dsibSTB6yWpwT5qWmC2OfuCg3GgVQCSgMs4vEctYPhsaGtd0AeuuHMkjZ2h2WG8MSzRw==",
+ "dev": true
+ },
+ "wrap-ansi": {
+ "version": "7.0.0",
+ "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz",
+ "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==",
+ "requires": {
+ "ansi-styles": "^4.0.0",
+ "string-width": "^4.1.0",
+ "strip-ansi": "^6.0.0"
+ },
+ "dependencies": {
+ "ansi-styles": {
+ "version": "4.3.0",
+ "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz",
+ "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==",
+ "requires": {
+ "color-convert": "^2.0.1"
+ }
+ },
+ "color-convert": {
+ "version": "2.0.1",
+ "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz",
+ "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==",
+ "requires": {
+ "color-name": "~1.1.4"
+ }
+ },
+ "color-name": {
+ "version": "1.1.4",
+ "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz",
+ "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA=="
+ }
+ }
+ },
+ "y18n": {
+ "version": "5.0.5",
+ "resolved": "https://registry.npmjs.org/y18n/-/y18n-5.0.5.tgz",
+ "integrity": "sha512-hsRUr4FFrvhhRH12wOdfs38Gy7k2FFzB9qgN9v3aLykRq0dRcdcpz5C9FxdS2NuhOrI/628b/KSTJ3rwHysYSg=="
+ },
+ "yargs": {
+ "version": "16.2.0",
+ "resolved": "https://registry.npmjs.org/yargs/-/yargs-16.2.0.tgz",
+ "integrity": "sha512-D1mvvtDG0L5ft/jGWkLpG1+m0eQxOfaBvTNELraWj22wSVUMWxZUvYgJYcKh6jGGIkJFhH4IZPQhR4TKpc8mBw==",
+ "requires": {
+ "cliui": "^7.0.2",
+ "escalade": "^3.1.1",
+ "get-caller-file": "^2.0.5",
+ "require-directory": "^2.1.1",
+ "string-width": "^4.2.0",
+ "y18n": "^5.0.5",
+ "yargs-parser": "^20.2.2"
+ }
+ },
+ "yargs-parser": {
+ "version": "20.2.4",
+ "resolved": "https://registry.npmjs.org/yargs-parser/-/yargs-parser-20.2.4.tgz",
+ "integrity": "sha512-WOkpgNhPTlE73h4VFAFsOnomJVaovO8VqLDzy5saChRBFQFBoMYirowyW+Q9HB4HFF4Z7VZTiG3iSzJJA29yRA=="
+ }
+ }
+}
diff --git a/package.json b/package.json
new file mode 100644
index 0000000..6dddd13
--- /dev/null
+++ b/package.json
@@ -0,0 +1,57 @@
+{
+ "name": "@squareboat/nest-console",
+ "version": "0.0.5",
+ "description": " The console package for your NestJS Applications",
+ "main": "dist/index.js",
+ "types": "dist/index.d.ts",
+ "keywords": [
+ "nestjs",
+ "nestjs-console",
+ "nestjs-cli"
+ ],
+ "repository": {
+ "type": "git",
+ "url": "https://github.com/squareboat/nest-console.git"
+ },
+ "bugs": {
+ "url": "https://github.com/squareboat/nest-console/issues"
+ },
+ "homepage": "https://github.com/squareboat/nest-console",
+ "author": "Vinayak Sarawagi ",
+ "private": false,
+ "license": "MIT",
+ "scripts": {
+ "build": "rm -rf dist && tsc -p tsconfig.json",
+ "format": "prettier --write \"**/*.ts\"",
+ "lint": "eslint 'lib/**/*.ts' --fix",
+ "readme:npm": "mv README.md README.git.md && mv README.npm.md README.md",
+ "readme:git": "mv README.md README.npm.md && mv README.git.md README.md",
+ "prepublish:npm": "npm run readme:npm && npm run build",
+ "publish:npm": "npm publish --access public",
+ "postpublish:npm": "npm run readme:git",
+ "prepublish:next": "npm run build",
+ "publish:next": "npm publish --access public --tag next",
+ "test:e2e": "jest --config ./tests/jest-e2e.json --runInBand",
+ "test:e2e:dev": "jest --config ./tests/jest-e2e.json --runInBand --watch"
+ },
+ "devDependencies": {
+ "@nestjs/common": "^7.4.2",
+ "@nestjs/core": "^7.4.2",
+ "@types/chalk": "^2.2.0",
+ "@types/inquirer": "^7.3.1",
+ "@types/node": "^14.14.10",
+ "@types/yargs": "^15.0.11",
+ "reflect-metadata": "^0.1.13",
+ "typescript": "^3.9.7"
+ },
+ "peerDependencies": {
+ "@nestjs/common": "^6.7.0 || ^7.0.0",
+ "@nestjs/core": "^6.7.0 || ^7.0.0"
+ },
+ "dependencies": {
+ "chalk": "^4.1.0",
+ "cli-table3": "^0.6.0",
+ "inquirer": "^7.3.3",
+ "yargs": "^16.2.0"
+ }
+}
diff --git a/tsconfig.json b/tsconfig.json
new file mode 100644
index 0000000..0086739
--- /dev/null
+++ b/tsconfig.json
@@ -0,0 +1,19 @@
+{
+ "compilerOptions": {
+ "module": "commonjs",
+ "declaration": true,
+ "strict": true,
+ "removeComments": true,
+ "noLib": false,
+ "emitDecoratorMetadata": true,
+ "experimentalDecorators": true,
+ "target": "es6",
+ "sourceMap": false,
+ "outDir": "./dist",
+ "rootDir": "./lib",
+ "skipLibCheck": true
+ },
+ "include": ["lib/**/*"],
+ "exclude": ["node_modules", "**/*.spec.ts", "tests"]
+ }
+
\ No newline at end of file