an-command

0.1.2 • Public • Published

中文

plugins

This is a command-line tool written in typescript and node that can be used as a plug-in to import and extend your own commands

Usage:

an command [args]

For example, hello command:

an hello world
# output:  hello,world

Develop your own plug-in

Create a new file in the plugins directory, in which you customize your commands and how they are implemented, and then export them, like this:

import { program } from "commander";

export const name = "hello";

export const command = program.command(name)
.description("Say hello")
.arguments("<name>")
.action((name: string) => {
console.log(`Hello, ${name}! `);
});

After we customize the command, all plugins under the plugins directory will be loaded in an.ts, so we don't need to manually register to use it,see the an.ts implementation for details.

Test your own plug-in

When the development is complete, we can use the npm run build or yarn build command to package the ts file, and it will also execute the npm link command, and we can run the command test directly.

an command args

Package Sidebar

Install

npm i an-command

Weekly Downloads

0

Version

0.1.2

License

MIT

Unpacked Size

11 kB

Total Files

15

Last publish

Collaborators

  • iamloser