commander-jsx
v0.6.9
Published
Command-line Arguments Parser with JSX support
Downloads
108
Maintainers
Readme
CommanderJSX
Command-line Arguments Parser with JSX support
Example
index.tsx
import { Command, createCommand } from 'commander-jsx';
Command.execute(
<Command
name="git"
version="2.10.0"
parameters="[command] [options]"
description="Distributed Version Control system"
>
<Command
name="remote"
description='Manage the set of repositories ("remotes") whose branches you track'
>
<Command
name="add"
description="Adds a remote named <name> for the repository at <url>"
options={{
tree: {
shortcut: 't',
parameters: '<branch>',
pattern: /^\w+$/,
description: 'Branch tree'
}
}}
executor={({ tree }, name, url) => console.log(tree, name, url)}
/>
</Command>
</Command>,
process.argv.slice(2)
);
tsconfig.json
{
"compilerOptions": {
"module": "CommonJS",
"moduleResolution": "Node",
"jsx": "react",
"jsxFactory": "createCommand",
"target": "ES2017",
"outDir": "dist/"
}
}
Then, run git help
in your terminal, it'll outputs:
git [command] [options]
Distributed Version Control system
Options:
-h, --help show Help information
-v, --version show Version number
Commands:
help [command] show Help information
remote Manage the set of repositories ("remotes") whose branches you track