Skip to content

Commit

Permalink
fix: add other commands
Browse files Browse the repository at this point in the history
  • Loading branch information
jdx committed Jan 27, 2018
1 parent e73b7e4 commit 394b5f0
Show file tree
Hide file tree
Showing 3 changed files with 75 additions and 0 deletions.
25 changes: 25 additions & 0 deletions src/commands/multi.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Command, {flags} from '@dxcli/command'
import {createEnv} from 'yeoman-environment'

export default class extends Command {
static flags: flags.Input = {
defaults: flags.boolean({description: 'use defaults for every setting'}),
options: flags.string({description: '(typescript|semantic-release|mocha)'}),
}
static args = [
{name: 'path', required: false}
]

async run() {
const env = createEnv()

env.register(
require.resolve('../generators/app'),
'dxcli:app'
)

const options = this.flags.options ? this.flags.options.split(',') : []

await env.run('dxcli:app', {type: 'multi', path: this.args.path, options, defaults: this.flags.defaults})
}
}
25 changes: 25 additions & 0 deletions src/commands/plugin.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Command, {flags} from '@dxcli/command'
import {createEnv} from 'yeoman-environment'

export default class extends Command {
static flags: flags.Input = {
defaults: flags.boolean({description: 'use defaults for every setting'}),
options: flags.string({description: '(typescript|semantic-release|mocha)'}),
}
static args = [
{name: 'path', required: false}
]

async run() {
const env = createEnv()

env.register(
require.resolve('../generators/app'),
'dxcli:app'
)

const options = this.flags.options ? this.flags.options.split(',') : []

await env.run('dxcli:app', {type: 'plugin', path: this.args.path, options, defaults: this.flags.defaults})
}
}
25 changes: 25 additions & 0 deletions src/commands/single.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import Command, {flags} from '@dxcli/command'
import {createEnv} from 'yeoman-environment'

export default class extends Command {
static flags: flags.Input = {
defaults: flags.boolean({description: 'use defaults for every setting'}),
options: flags.string({description: '(typescript|semantic-release|mocha)'}),
}
static args = [
{name: 'path', required: false}
]

async run() {
const env = createEnv()

env.register(
require.resolve('../generators/app'),
'dxcli:app'
)

const options = this.flags.options ? this.flags.options.split(',') : []

await env.run('dxcli:app', {type: 'single', path: this.args.path, options, defaults: this.flags.defaults})
}
}

0 comments on commit 394b5f0

Please sign in to comment.