0.2.10 • Published 8 months ago

@armit/cli v0.2.10

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

@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

0.2.10

8 months ago

0.2.9

10 months ago

0.1.9

1 year ago

0.2.1

1 year ago

0.2.0

1 year ago

0.2.7

11 months ago

0.2.6

11 months ago

0.2.8

11 months ago

0.2.3

12 months ago

0.2.2

1 year ago

0.2.5

11 months ago

0.2.4

11 months ago

0.1.8

1 year ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

1 year ago

0.1.2

1 year ago

0.1.1

2 years ago

0.1.0

2 years ago

0.0.60

2 years ago

0.0.61

2 years ago

0.0.59

2 years ago

0.0.52

2 years ago

0.0.54

2 years ago

0.0.55

2 years ago

0.0.56

2 years ago

0.0.57

2 years ago

0.0.58

2 years ago

0.0.40

2 years ago

0.0.41

2 years ago

0.0.42

2 years ago

0.0.43

2 years ago

0.0.44

2 years ago

0.0.45

2 years ago

0.0.46

2 years ago

0.0.47

2 years ago

0.0.37

2 years ago

0.0.38

2 years ago

0.0.39

2 years ago

0.0.35

2 years ago

0.0.36

2 years ago

0.0.51

2 years ago

0.0.50

2 years ago

0.0.48

2 years ago

0.0.49

2 years ago

0.0.21

2 years ago

0.0.22

2 years ago

0.0.23

2 years ago

0.0.24

2 years ago

0.0.25

2 years ago

0.0.17

2 years ago

0.0.18

2 years ago

0.0.19

2 years ago

0.0.30

2 years ago

0.0.31

2 years ago

0.0.32

2 years ago

0.0.33

2 years ago

0.0.34

2 years ago

0.0.26

2 years ago

0.0.27

2 years ago

0.0.28

2 years ago

0.0.29

2 years ago

0.0.16

2 years ago

0.0.12

2 years ago

0.0.13

2 years ago

0.0.14

2 years ago

0.0.15

2 years ago

0.0.11

3 years ago

0.0.10

3 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago