New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@point-hub/express-cli

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@point-hub/express-cli

Express command line interface wrapper

  • 0.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

Express Cli

This is an Express ESM-only module library - you are not able to import it with require().

Install

npm install @point-hub/express-cli

Directory Example

•
├── bin
│   └── cli.js
├── lib
└── src
    ├── commands
    │   └── example-command.ts
    └── index.ts

Usage Example

  1. create command file src/commands/greet-command.ts
import { BaseCommand } from "@point-hub/express-cli";

export class GreetCommand extends BaseCommand {
  constructor() {
    super({
      name: "greet",
      summary: "Welcome someone",
      description: "Welcome someone with particular words",
      alias: ["gret", "say"],
      arguments: [
        {
          name: "name",
          description: "Your name",
        },
      ],
      options: [
        {
          type: "boolean",
          flag: "--smile",
          shorthand: "-s",
          description: "Add smiley :)",
        },
      ],
    });
  }
  handle() {
    // handle command here
  }
}

  1. create an entry point file src/ìndex.ts
import { ExpressCli } from "@point-hub/express-cli";
import { GreetCommand } from "./commands/greet.command.js";

/**
 * Register the commands for the application.
 *
 * @example
 * command.register(ExampleCommand);
 */
export function commands(command: ExpressCli): void {
  command.register(new GreetCommand());
}
  1. compile typescript to "lib" directory

  2. create an executeable file bin/cli.js and make it executeable chmod +x bin/cli.js

#!/usr/bin/env node

import { commands } from "../lib/index.js";
import { ExpressCli } from "@point-hub/express-cli";

const cli = new ExpressCli("cli");
commands(cli);
cli.run(process.argv);
  1. try your command using node bin/cli.js greet John

Keywords

FAQs

Package last updated on 08 Jul 2022

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