All Projects → mgrip → React Cli

mgrip / React Cli

Licence: mit
a react renderer for the command line

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to React Cli

Cac
Simple yet powerful framework for building command-line apps.
Stars: ✭ 1,017 (+2211.36%)
Mutual labels:  cli, command-line
Ed
A modern UNIX ed (line editor) clone written in Go
Stars: ✭ 44 (+0%)
Mutual labels:  cli, command-line
Sit Up
🙇 Reminder to sit up straight.
Stars: ✭ 9 (-79.55%)
Mutual labels:  cli, command-line
Laminas Cli
Console command runner, exposing commands written in Laminas MVC and Mezzio components and applications
Stars: ✭ 25 (-43.18%)
Mutual labels:  cli, command-line
Wonders
🌈 Declarative JavaScript framework to build command-line applications.
Stars: ✭ 34 (-22.73%)
Mutual labels:  cli, command-line
Inquirer Checkbox Plus Prompt
Checkbox with autocomplete and other additions for Inquirer
Stars: ✭ 25 (-43.18%)
Mutual labels:  cli, command-line
Executor
Watch for file changes and then execute command. Very nice for test driven development.
Stars: ✭ 14 (-68.18%)
Mutual labels:  cli, command-line
Ntl
Node Task List: Interactive cli to list and run package.json scripts
Stars: ✭ 800 (+1718.18%)
Mutual labels:  cli, command-line
Todo r
Find all your TODO notes with one command!
Stars: ✭ 28 (-36.36%)
Mutual labels:  cli, command-line
Cht.exe
cht.sh libcurl client for windows XP+ with changed colorization
Stars: ✭ 15 (-65.91%)
Mutual labels:  cli, command-line
Mprislyrics
Small command-line utility that displays lyrics in sync with the currently playing song in a MPRIS2 capable player.
Stars: ✭ 24 (-45.45%)
Mutual labels:  cli, command-line
Snoo
A Reddit command line client written in Node.js, using modern ES-features
Stars: ✭ 39 (-11.36%)
Mutual labels:  cli, command-line
Clifx
Declarative framework for building command line interfaces
Stars: ✭ 900 (+1945.45%)
Mutual labels:  cli, command-line
Elodie
An EXIF-based photo assistant, organizer, manager and workflow automation tool.
Stars: ✭ 840 (+1809.09%)
Mutual labels:  cli, command-line
Aruba
Test command-line applications with Cucumber-Ruby, RSpec or Minitest. The most up to date documentation can be found on Cucumber.Pro (https://app.cucumber.pro/projects/aruba)
Stars: ✭ 900 (+1945.45%)
Mutual labels:  cli, command-line
Xsv
A fast CSV command line toolkit written in Rust.
Stars: ✭ 7,831 (+17697.73%)
Mutual labels:  cli, command-line
Ipt
Interactive Pipe To: The Node.js cli interactive workflow
Stars: ✭ 783 (+1679.55%)
Mutual labels:  cli, command-line
Prompts
❯ Lightweight, beautiful and user-friendly interactive prompts
Stars: ✭ 6,970 (+15740.91%)
Mutual labels:  cli, command-line
Ecsctl
Command-line tool for managing AWS Elastic Container Service and Projects to run on it.
Stars: ✭ 15 (-65.91%)
Mutual labels:  cli, command-line
Make Me Lol
😄 A command-line tool to make you laugh
Stars: ✭ 38 (-13.64%)
Mutual labels:  cli, command-line

This repository is now archived

This project was originally created as an alternative to the Ink library, as a separate renderer for a real React component tree, for the command line. Ink has since changed its architecture to also become just a separate renderer, allowing the use of the actual React library. With this change, react-cli adds no extra value beyond the capabilities of the Ink library, which has a much larger user-base and its better supported.

ReactCLI

ReactCLI is a react renderer for the command line. All of the benefits of React, right in your terminal.

react-cli-demo

import ReactCLI, { Section } from "react-cli-renderer";
import React from "react";
import chalk from "chalk";

class MyReactCLIApp extends React.Component {
  state = {
    step: 0
  };

  componentDidMount() {
    setTimeout(() => this.setState({ step: 1 }), 1000);
    setTimeout(() => this.setState({ step: 2 }), 2000);
    setTimeout(() => this.setState({ step: 3 }), 3000);
  }

  render() {
    return (
      <Section border={{ horizontal: "*", vertical: "*" }} align="center">
        My {chalk.blue("New")} {chalk.magenta("ReactCLI App")} 🚀
        <Section horizontal>
          <Section align="center">
            {this.state.step >= 1 ? chalk.green("✔︎") : "◯"} Step 1<br />
            {this.state.step >= 2 ? chalk.green("✔︎") : "◯"} Step 2<br />
            {this.state.step >= 3 ? chalk.green("✔︎") : "◯"} Step 3
          </Section>
          <Section border={{ horizontal: "-", vertical: "|" }} align="center">
            Number of steps done:{" "}
            {chalk.bold.magenta(this.state.step.toString())}
          </Section>
        </Section>
      </Section>
    );
  }
}

ReactCLI(<MyReactCLIApp />);

note: this example uses the "@babel/preset-env", "@babel/preset-react" babel presets, and "@babel/plugin-proposal-class-properties" plugin

Getting started

yarn

yarn add react react-cli-renderer

npm

npm install --save react react-cli-renderer

note: You can use react-cli-renderer without babel, but you'll most likely want to write components using JSX.

Compatibility with ink components

ink components do not work out-of-the-box with react-cli. However, if you're interested in re-using existing ink components, check out ink-on-reactcli for more information.

About

ReactCLI is analogous to ReactDOM or ReactNative. It just renders any updates dictated by React and the React reconciler to the command line. This means that you get all of the core features of React for free, like stateful components, context, refs, etc - in addition to being able to use third party libraries for things like state management. It also provides a couple core components that are useful for building out command line interfaces.

Usage

Components

ReactCLI provides two components for building command line interfaces.

  • Section A new section is denoted by Section. A section can either be vertical, or horizontal. The children of a section can be a mix of text, or more sections. A section can also align text left, right, or center.

    <Section horizontal>
      <Section>Column 1</Section>
      <Section>Column 2</Section>
    </Section>
    
  • break Break components allow you to define columns and/or rows within a section (as opposed to using nested sections).

    <Section>
      Row 1<br />
      Row 2
    </Section>
    

Built with ReactCLI

if you're using ReactCLI and want to add your project to this list, feel free to submit a PR!

Contributions welcome!

👨‍🎤👩‍🔬👨‍🎨

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].