Skip to content

Commit

Permalink
feat: show version on root help
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Mar 24, 2018
1 parent 5b943d6 commit 988de52
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions src/root.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export default class RootHelp {
let description = this.config.pjson.oclif.description || this.config.pjson.description || ''
description = this.render(description)
description = description.split('\n')[0]
description = `${this.config.userAgent}\n${description}`
let output = compact([
description,
this.usage(),
Expand Down
6 changes: 5 additions & 1 deletion test/commands/help.test.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
import {expect, test} from '@oclif/test'

const VERSION = require('../../package.json').version
const UA = `@oclif/plugin-help/${VERSION} ${process.platform}-${process.arch} node-${process.version}`

describe('help command', () => {
test
.stdout()
Expand Down Expand Up @@ -47,7 +50,8 @@ OPTIONS
.stdout()
.command(['help'])
.it('shows root help', ctx => {
expect(ctx.stdout).to.equal(`standard help for oclif
expect(ctx.stdout).to.equal(`${UA}
standard help for oclif
USAGE
$ oclif [COMMAND]
Expand Down
6 changes: 5 additions & 1 deletion test/root.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ import stripAnsi = require('strip-ansi')
global.columns = 80
import Help from '../src'

const VERSION = require('../package.json').version
const UA = `@oclif/plugin-help/${VERSION} ${process.platform}-${process.arch} node-${process.version}`

const test = base
.loadConfig()
.add('help', ctx => new Help(ctx.config))
Expand All @@ -21,7 +24,8 @@ const test = base
describe('root help', () => {
test
.rootHelp()
.it(ctx => expect(ctx.commandHelp).to.equal(`standard help for oclif
.it(ctx => expect(ctx.commandHelp).to.equal(`${UA}
standard help for oclif
USAGE
$ oclif [COMMAND]`))
Expand Down

0 comments on commit 988de52

Please sign in to comment.