Nightly Perpetrated Mischief

    commander-jsx
    TypeScript icon, indicating that this package has built-in type declarations

    0.5.0 • Public • Published

    CommanderJSX

    Command-line Arguments Parser with JSX support

    NPM Dependency Build Status

    NPM

    Example

    index.tsx

    import { Command, createCommand } from 'commander-jsx';
     
    Command.execute(
        <git version="2.10.0" description="Distributed Version Control system">
            <remote
                description={`Manage the set of repositories ("remotes") whose branches you track`}
            >
                <add
                    description="Adds a remote named <name> for the repository at <url>"
                    options={{
                        t: { parameters: '<branch>', description: 'Branch tree' }
                    }}
                    executor={({ t }, name, url) => console.log(t, name, url)}
                />
            </remote>
        </git>,
        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
    

    Install

    npm i commander-jsx

    DownloadsWeekly Downloads

    7

    Version

    0.5.0

    License

    LGPL-3.0

    Unpacked Size

    21.9 kB

    Total Files

    16

    Last publish

    Collaborators

    • avatar