JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 88
  • Score
    100M100P100Q66126F
  • License LGPL-3.0

Command-line Arguments Parser with JSX support

Package Exports

  • commander-jsx
  • commander-jsx/dist/index.js
  • commander-jsx/source/index.ts

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (commander-jsx) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

CommanderJSX

Command-line Arguments Parser with JSX support

NPM Dependency CI & CD

NPM

Versions

SemVer status JSX
>=0.7 ✅developing import source
<0.7 ❌deprecated factory function

Example

index.tsx

import { Command } 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-jsx",
        "jsxImportSource": "commander-jsx",
        "target": "ES2017",
        "outDir": "dist/"
    }
}

Usage

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

Typical cases

  1. https://github.com/idea2app/Git-utility
  2. https://github.com/TechQuery/Web-fetch
  3. https://github.com/TechQuery/KoApache
  4. https://github.com/TechQuery/fs-match