dthree / dthree/vorpal

Support for version task by default

Open
#161 3 comments 3 reactions 0 assignees View on GitHub
Dominant language
JavaScript
Stars
5.6k
Forks
278
PR merge metrics
No merged PRs in 30d

Description

Currently I have a built-in node CLI for [Grommet](https://github.com/grommet/grommet).

I'm in the process of investigating a framework to handle the CLI for me. I've compared multiple frameworks and yours is the one I liked the most API-wise. Good job!

Our CLI today has a `grommet --version`. I was wondering if you have something similar that would output the version of the CLI. For now, this is what I did, but I believe this task is generic enough that could be added be default as we have `help` and `exit`.

``` javascript
#!/usr/bin/env node
import vorpal from 'vorpal';
import path from 'path';

const cli = vorpal();
const cliPath = path.join(__dirname, '..');
const packageJSON = require(path.join(cliPath, 'package.json'));

cli
.command('version')
.action((args, cb) => {
cli.log(packageJSON.version);
cb();
});

cli
.delimiter(cli.chalk.magenta('grommet~$'))
.show();

```

I would be happy to create a PR if you think that this is useful.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.