Command Line Interface for working with the Dolittle Platform
$ git clone https://github.com/dolittle-platform/cli.git
$ cd cli/Source
$ npm install
$ npm link
Add a file for the command in the right place. This file will be a node "binary". On top of the new JavaScript file add the following:
#!/usr/bin/env node
Then you need to change the files attributes so that it is an executable:
$ chmod +x <file>
The file should now be possible to run by typing ./<file.js>
.
To hook this up, the args
node package is looking by convention from the commands being setup.
So for instance the following command:
let args = require("args");
args
.command("create", "Create a Dolittle artifact");
will map to a node "binary" called dolittle-create
.
This is configured in the packages.json
file:
{
"bin": {
"dolittle-create": "create/create.js"
}
}
When you've got all this setup, you simply run npm link
to get it linked.