ink-router-cli

A react-router style CLI parser for InkJS.

MIT License

Stars
5
Committers
2

ink-cli-parser

ink-cli-parser is a cli parser tool that is built just for ink. You can pass in you custom ink help component and error component.

Table Of Contents

Getting Started

To install ink-cli-parser, ensure that you have Node.js >=10. Install nodejs from here

Installation

The easiest way to install ink-cli-parser is using NPM. If you have Node.js installed, it is most likely that you have NPM installed as well

$ npm install ink-cli-parser

Usage

import React, { FC } from "react";
import { Router, Switch, Command } from "ink-cli-router";
import { render, Text } from "ink";

const Create = () => {
  return <Text>{"Creating file"}</Text>;
};

const App: FC<{ any }> = () => {
  return (
    <Router argv={process.argv}>
      <Switch>
        <Command name="create" component={<Create />} />
      </Switch>
    </Router>
  );
};

render(<App />);

Api Reference

To read more about the API you can visit here