0.3.0 • Published 8 months ago

@armit/cli v0.3.0

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.15

10 months ago

0.2.14

11 months ago

0.2.13

12 months ago

0.2.12

1 year ago

0.2.11

1 year ago

0.3.0

8 months ago

0.2.10

1 year ago

0.2.9

1 year ago

0.1.9

2 years ago

0.2.1

2 years ago

0.2.0

2 years ago

0.2.7

2 years ago

0.2.6

2 years ago

0.2.8

2 years ago

0.2.3

2 years ago

0.2.2

2 years ago

0.2.5

2 years ago

0.2.4

2 years ago

0.1.8

2 years ago

0.1.6

2 years ago

0.1.5

2 years ago

0.1.4

2 years ago

0.1.3

2 years ago

0.1.2

2 years 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

3 years ago

0.0.54

3 years ago

0.0.55

3 years ago

0.0.56

2 years ago

0.0.57

2 years ago

0.0.58

2 years ago

0.0.40

3 years ago

0.0.41

3 years ago

0.0.42

3 years ago

0.0.43

3 years ago

0.0.44

3 years ago

0.0.45

3 years ago

0.0.46

3 years ago

0.0.47

3 years ago

0.0.37

3 years ago

0.0.38

3 years ago

0.0.39

3 years ago

0.0.35

3 years ago

0.0.36

3 years ago

0.0.51

3 years ago

0.0.50

3 years ago

0.0.48

3 years ago

0.0.49

3 years ago

0.0.21

3 years ago

0.0.22

3 years ago

0.0.23

3 years ago

0.0.24

3 years ago

0.0.25

3 years ago

0.0.17

3 years ago

0.0.18

3 years ago

0.0.19

3 years ago

0.0.30

3 years ago

0.0.31

3 years ago

0.0.32

3 years ago

0.0.33

3 years ago

0.0.34

3 years ago

0.0.26

3 years ago

0.0.27

3 years ago

0.0.28

3 years ago

0.0.29

3 years ago

0.0.16

3 years ago

0.0.12

3 years ago

0.0.13

3 years ago

0.0.14

3 years ago

0.0.15

3 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