🚨 Active Supply Chain Attack:node-ipc Package Compromised.Learn More
Socket
Book a DemoSign in
Socket

@armit/cli

Package Overview
Dependencies
Maintainers
2
Versions
86
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@armit/cli

A tool the modern for rapidly building command line armitjs apps

Source
npmnpm
Version
0.2.12
Version published
Weekly downloads
102
-32%
Maintainers
2
Weekly downloads
 
Created
Source

@armit/cli

A tool the modern for rapidly building command line armitjs apps

Install globally

  • npm i -g @armit/cli

Module/Programmatic Usage

  • yarn add @armit/cli

Add this package to package dependencies linked to your app, just import them like regular packages:

import { bootstrap } from '@armit/cli';

bootstrap().then((cli) => {
  // Register customized plugins chain.
  cli.register(pluginA).register(pluginB);

  // Parse progress arguments.
  cli.parse(process.argv.slice(2));
});

Create a custom armitjs-based plugin chain e.g. arm test

  • armit-cli-plugin-test/package.json
    "type": "module",
    "exports": {
      ".": {
        "import": "./index.js"
      },
      "./package.json": "./package.json"
    },
    
  • armit-cli-plugin-test/src/index.ts
import type { CommandArgv } from "@armit/commander";
import { AbstractHandler, createCommand } from "@armit/commander";

type TestCmdArgs = CommandArgv<{
  test: number;
}>;

class CmdTestHandle extends AbstractHandler<TestCmdArgs> {
  handle(): void | Promise<void> {
    console.log("this is test command handle");
    this.logger.debug("this is debug message for test command");
  }
}

const cmdTest = createCommand(
  "test",
  {
    command: "test",
    describe: "Display armit project details.",
    builder: (yargs) => {
      return yargs.example(`$0 cmd test `, "cli testing").option("test", {
        type: "number",
        alias: "t",
        default: true,
        describe: `cli option test describe`,
      });
    },
  },
  CmdTestHandle
);

// As named export `cmdtest`
export const myPlugin = definePlugin({
  name:'cmdtest',
  commandModule: cmdTest;
});

//  As named export `cmdtest2`
export const myPlugin = definePlugin({
  name:'cmdtest2',
  commandModule: cmdTest;
});

Contributing

Contributions are happily accepted. I respond to all PR's and can offer guidance on where to make changes. For contributing tips see CONTRIBUTING.md

FAQs

Package last updated on 24 Dec 2024

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