Cleanquirer
Create a cli tool from a documented javascript API 💻
Introduction
This module provides a way to easily generate node CLI modules, eventually using files documented with documentation.js.
Get started
Create and use a simple CLI
First, implement one or more commands with documentation using the following pattern (one file for each command):
// path/to/command/file.js /** * @name my-cli-command */{ // do some asynchronous stuffs} moduleexports = cliCommand
Now, you have to create a cli function using cleanquirer:
// path/to/cli-function.js const path = ; const cleanquirer = ; moduleexports =
You can use the exported function to call methods of the cli api directly in javascript
// path/to/a/file.js const myCli = ;
Then you just have to create a bin file which will do the link between myCli and the terminal input
path/to/bin/myCli#!/usr/bin/env node 'use strict'; processargv;
And fill the bin field in your module package.json
// package.json
"bin": {
"cli-name": "path/to/bin/myCli"
}
Roadmap
-
command options support (automaticaly deduced from files comments and/or function signature)
-
provide a prompt method (like inquirer) in order to allow easy user interactions
-
automaticaly prompt the missing options when user uses a command
-
help command/flag support
-
options aliases support
-
global options support
-
commands aliases support
Documentation
License
cleanquirer is released under MIT. Copyright (c) 2017-present Alexis Tessier