How to Build your own CLI

Here is a framework from which you can build your own CLI.

oclif is a framework for building CLIs in Node. It can be used like a simple flag parser but is capable of much more. It’s designed to be extensible so that you can easily add plugins such as the update warning plugin or build your own for users to install at runtime.

The oclif generator creates a CLI project in TypeScript to get you started quickly. It requires very few runtime dependencies and has extremely minimal overhead.

Everything is customizable in oclif. Even the flag parser and help generation is optional and can be replaced. It’s a platform to build upon that provides smart defaults without locking you in to any specific tools or behavior.

$ npx oclif generate mynewcli

$ npm package name (mynewcli): mynewcli

$ cd mynewcli

$ ./bin/dev hello world hello world! (./src/commands/hello/world.ts)

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Manjunathkalburgi

Manjunathkalburgi

13 Followers

I am a software developer and international dance fitness instructor