Skip to content
This repository was archived by the owner on Oct 16, 2024. It is now read-only.

Commit 0144988

Browse files
author
Jeff Dickey
committed
fix mixin
1 parent 84b1fe1 commit 0144988

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

src/commands/duration.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,18 @@
11
// @flow
22

33
import Command from 'cli-engine-command'
4-
import Duration from '../mixins/duration'
4+
import Duration, {DurationFlag} from '../mixins/duration'
55

66
export default class extends Command {
77
static topic = 'cli'
88
static command = 'duration'
99
static description = 'this is an example command showing duration parsing'
10+
static flags = [DurationFlag]
1011

1112
duration = new Duration(this)
1213

1314
run () {
14-
this.log(`duration: ${this.duration.toString()}`)
15+
this.log('duration:')
16+
this.inspect(this.duration.value)
1517
}
1618
}

src/mixins/duration.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
import type Command from 'cli-engine-command'
44

5-
export const FLAG = {
5+
export const DurationFlag = {
66
name: 'duration',
77
description: 'a duration',
88
required: true,
@@ -15,7 +15,7 @@ export default class Duration {
1515
this.cmd = cmd
1616
}
1717

18-
get duration (): Date {
18+
get value (): Date {
1919
let duration = this.cmd.flags.duration
2020
return new Date(duration)
2121
}

0 commit comments

Comments
 (0)