I hereby claim:
-
I am kenanchristian on github.
-
I am kenanchristian (https://keybase.io/kenanchristian) on keybase.
-
I have a public key ASC_HpN80L9Eb82i_Ih4XDrKnxlKCg4wF1v5nm4KJ6_zNQo
I hereby claim:
I am kenanchristian on github.
I am kenanchristian (https://keybase.io/kenanchristian) on keybase.
I have a public key ASC_HpN80L9Eb82i_Ih4XDrKnxlKCg4wF1v5nm4KJ6_zNQo
import {Command, flags} from '@oclif/command' | |
export default class Hello extends Command { | |
static description = 'describe the command here' | |
static examples = [ | |
`$ pizza hello | |
hello world from ./src/hello.ts! | |
`, | |
] |
import {Command, flags} from '@oclif/command' | |
export default class Create extends Command { | |
static description = 'Create a new Pizza' | |
static examples = [ | |
`$ pizza create | |
Your pizza is ready! | |
`, | |
] |
import {Command, flags} from '@oclif/command' | |
import {prompt} from 'inquirer' | |
export default class Create extends Command { | |
static description = 'Create a new Pizza' | |
static examples = [ | |
`$ pizza create | |
Your pizza is ready! | |
`, |
/* eslint-disable no-await-in-loop */ | |
import {Command, flags} from '@oclif/command' | |
import {prompt} from 'inquirer' | |
import {SingleBar, Presets} from 'cli-progress' | |
import {yellow, green, cyan} from 'chalk' | |
import {sleep} from '../lib/util' | |
interface PizzaData { | |
crust: string; | |
toppings: string[]; |
static description = 'Create a new Pizza' | |
static examples = [ | |
`$ pizza create | |
Your pizza is ready! | |
`, | |
] |
static flags = { | |
help: flags.help({char: 'h'}), | |
crust: flags.string({char: 'c', description: 'Type of Crust (Thin/Thick)'}), | |
toppings: flags.string({char: 't', description: 'Toppings to add', options: ['pepperoni', 'mushroom', 'bacon', 'pineapple'], multiple: true}), | |
extraSauce: flags.boolean({char: 'x', description: 'Do you want extra sauce?'}), | |
} | |
static args = [ | |
{ | |
name: 'count', |
async run() { | |
const {args, flags} = this.parse(Create) | |
this.log(JSON.stringify(args)) | |
this.log(JSON.stringify(flags)) | |
this.log('Your pizza is ready!') | |
} |
import { prompt } from 'inquirer' | |
... | |
async run() { | |
const userInput = prompt([ | |
{ | |
type: 'number', | |
name: 'count', |
... | |
async getInteractiveArgs() { | |
const answer = await prompt([ | |
{ | |
type: 'number', | |
name: 'count', | |
message: 'How many pizza you want to create', | |
default: 1, | |
validate(value) { |