Creating your own command line tool is amazing and gives you the opportunity of explore a new world out of the web.
Sometimes you will encounter some issues on creating those command line tools because the lack of reusability of code that could be reused in each and every one of your tools.
If you are an open source’s fan you will also want to share your code with other people so they can also reuse it and take advantage of your work.
Because of all that Commular was designed and developed to be a pluggable framework of easy development without having to invent anything new because it extends existing, and very opinionated, CLI frameworks.
npm install commular --save
git clone https://github.com/commular/commular-cli-template.git <<CLI_NAME>>
npm link
in the root of your project to work locally.npm install --save <<COMMULAR_PLUGIN_PACKAGE_NAME>>
to install plugins.Commular has been developed on top of:
You can use commmander or vorpal with Commular.
git clone https://github.com/commular/commular.git <<CLI_NAME>>
npm link
in the root of your project to work locally.npm install --save <<COMMULAR_PLUGIN_PACKAGE_NAME>>
to install plugins.It can’t be easier… just use npm to install commander or vorpal and Commular will check what module you installed.
npm install --save commander
npm install --save vorpal
Use npm to install all the plugins you need Commular will manage them for you.
We work as other pluggable tools (Grunt, Gulp…)
You can find all the plugins reviewed by our team in Commular organization
You can also could find third party plugins in Github, Bitbucket and NPM, to find them you only have to search for:
commular-
You can develop your own plugins you only need to follow some simple steps.
Commular as Grunt, Gulp or jQuery enforce you to use our prefix, commular, to name your plugins but we also understand that sometimes it’s not possible so we also though on it and you can define what prefixes want Commular to manage.
By default Commular manages those plugins that are prefixed by commular and also those that are prefixed with the same name of your CLI.
Imagine that you have to create your own CLI, named biz and…
That’s what you need to do to use them all in your app is:
"commular-plugin-prefixes": []
"commular-plugin-prefixes": "rd"
"commular-plugin-prefixes": [ "rd", "twitter" ]
To get more information we recommend you:
git clone https://github.com/commular/commular-plugin-template.git [YOUR_PLUGIN_NAME]
scripts/index.js
and see that there is only the following code:exports.command = function (program) {
/**
* "program" returns an instance of "commander" or "vorpal".
* Develop your command/s in this function as usual.
* More information about how to do that in the website of the CLI framework
* you decided to use.
**/
};
Test your plugin.
If you want us to review your commular plugin we will ask you for testing. We will not accept any plugin without the required testing.
That’s not a problem at all because we are using NPM to manage dependencies.
Assumptions: - The tool’s name, you are developing, is ‘cli’. - You are creating a ‘plugins’ folder in the root of your tool. - The name of your plugin is ‘commular-parse-xml’
npm install --save ./plugins/commular-parse-xml
npm link
to work with your ‘cli’ tool as if it was installed globally.