No known key found for this signature in database
GPG Key ID: 51D5A407BFCE64A9
4 changed files with
3 additions and
33 deletions
-
.eslintignore
-
src/commands/add/prettier.ts
-
src/commands/hello/index.ts
-
src/utls/base-command.ts
|
|
|
@ -3,7 +3,7 @@ import { BaseCommand } from '../../utls/base-command'; |
|
|
|
import { system, filesystem } from 'gluegun'; |
|
|
|
import * as prompts from 'prompts'; |
|
|
|
import * as fs from 'fs'; |
|
|
|
import { plugins, statusMatrix, add, commit } from 'isomorphic-git'; |
|
|
|
import { plugins, add, commit } from 'isomorphic-git'; |
|
|
|
import { BaseAddCommand } from '../../utls/base-add-command'; |
|
|
|
|
|
|
|
plugins.set('fs', fs); |
|
|
|
|
|
|
|
@ -1,31 +0,0 @@ |
|
|
|
import { Command, flags } from '@oclif/command'; |
|
|
|
|
|
|
|
export default class Index extends Command { |
|
|
|
static description = 'describe the command here'; |
|
|
|
|
|
|
|
static examples = [ |
|
|
|
`$ nbx hello
|
|
|
|
hello world from ./src/hello.ts! |
|
|
|
`,
|
|
|
|
]; |
|
|
|
|
|
|
|
static flags = { |
|
|
|
help: flags.help({ char: 'h' }), |
|
|
|
// flag with a value (-n, --name=VALUE)
|
|
|
|
name: flags.string({ char: 'n', description: 'name to print' }), |
|
|
|
// flag with no value (-f, --force)
|
|
|
|
force: flags.boolean({ char: 'f' }), |
|
|
|
}; |
|
|
|
|
|
|
|
static args = [{ name: 'file' }]; |
|
|
|
|
|
|
|
async run() { |
|
|
|
const { args, flags } = this.parse(Index); |
|
|
|
|
|
|
|
const name = flags.name || 'world'; |
|
|
|
this.log(`hello ${name} (${args.file}) from ./src/commands/hello.ts`); |
|
|
|
if (args.file && flags.force) { |
|
|
|
this.log(`you input --force and --file: ${args.file}`); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -27,7 +27,7 @@ export abstract class BaseCommand extends Command { |
|
|
|
|
|
|
|
async init() { |
|
|
|
// do some initialization
|
|
|
|
const { flags, args, argv } = this.parse(<Input<any>>this.constructor); |
|
|
|
const { flags, args, argv } = this.parse(this.constructor as Input<any>); |
|
|
|
this.flags = flags; |
|
|
|
|
|
|
|
if (flags.verbose) { |
|
|
|
|