@/命令-行
为使用外置创建命令行工具提供一个框架。 当然,这是命令行处理库 用于外置 CLI,但它可用于任何你可能需要构建的命令行工具.
开始
// src/main.ts
import PKG = require('../package.json');
let line = new CommandLine()
.info({
executable: 'my-tool',
description: 'An example CLI application',
copyright: 'Copyright 2023 Me',
version: PKG.version
})
.command('frobulate', cmd => {
cmd .info({
description: 'Frobulate the given value',
argumentUsage: '<value>'
})
.run(([ value ]) => {
console.log(`You have frobulated ${value}!`);
})
;
})
.run(() => line.showHelp());
;
line.process();