Skip to content

Latest commit

 

History

History
103 lines (74 loc) · 2.01 KB

File metadata and controls

103 lines (74 loc) · 2.01 KB

Node NPM TypeScript

Komutan

A CLI tool for creating and managing CommanderJS CLI tools inspired by cobra-cli

CLI Preview

Features

  • Scaffold initial typescript app structure
  • Add new command
  • Test CLI locally by building and linkingæ
  • Publish to npmjs

Install

From npmjs

npm i -g komutan
komutan

From github

Clone and install dependencies:

git clone https://github.com/atasoya/komutan.git
cd komutan
npm install
npm run build
npm link
komutan

Usage

Create fresh CLI app

Creates initial clean typescript CLI app structure

komutan init <name>
Project Structure
./
├── src/
│   ├── index.ts              # CLI entry (Commander)
│   └── program/
│       ├── metadata.ts       # CLI metadata
│       ├── program.ts        # Main program object
│       └── commands/         # CLI commands
│           ├── hello.ts
│           └── index.ts      # Main entry
├── package.json
├── package-lock.json
├── tsconfig.json
└── .gitignore

Add new commands

Adds new command by creating name.ts and adding import to the index.ts

komutan add <name>
Command Template
import { program } from "../program";

program.command('#name#')
    .description('Description of the command')
    .action(() => {
        console.log("#name#");
  });
`;

Test CLI localy

Combines npm run build and npm link to one command.

komutan test

Publish CLI to npmjs

Version and publish to npmjs (you may need to login first: npm login )

komutan publish