How to use @microsoft/bf-cli-command - 10 common examples

To help you get started, we’ve selected a few @microsoft/bf-cli-command examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github microsoft / BotBuilder-Samples / experimental / generation / generator / src / commands / dialog / generate.ts View on Github external
static args = [
        { name: 'schema', required: true, description: 'JSON Schema .schema file used to drive generation.' }
    ]

    static flags: flags.Input = {
        debug: flags.boolean({ description: 'Show extra debugging information.' }),
        force: flags.boolean({ char: 'f', description: 'Force overwriting generated files.' }),
        help: flags.help({ char: 'h' }),
        locale: flags.string({ char: 'l', description: 'Locales to generate. [default: en-us]', multiple: true }),
        merge: flags.boolean({ description: 'Merge generated results into output directory.', default: false }),
        output: flags.string({ char: 'o', description: 'Output path for where to put generated .lu, .lg, .qna and .dialog files.', default: '.', required: false }),
        prefix: flags.string({ char: 'p', description: 'Prefix to use for generated files. [default: schema name]' }),
        schema: flags.string({ char: 's', description: 'Path to your app.schema file.', required: false }),
        singleton: flags.boolean({ description: 'Specify to generate a single .dialog file.' }),
        templates: flags.string({ char: 't', description: 'Directory with templates to use for generating assets.  With multiple directories, the first definition found wins.  To include the standard templates, just use "standard" as a template directory name.', multiple: true }),
        verbose: flags.boolean({ description: 'Output verbose logging of files as they are processed', default: false }),
    }

    async run() {
        const { args, flags } = this.parse(GenerateDialog)
        let feedback = (type: gen.FeedbackType, msg: string) => {
            if (type === gen.FeedbackType.message
                || (type === gen.FeedbackType.info && flags.verbose)) {
                this.info(msg)
            } else if (type === gen.FeedbackType.warning) {
                this.warning(msg)
            } else if (type === gen.FeedbackType.error) {
                this.errorMsg(msg)
            } else if (type === gen.FeedbackType.debug && flags.debug) {
                this.info(msg)
            }
github microsoft / BotBuilder-Samples / experimental / generation / generator / src / commands / dialog / generate / swagger.ts View on Github external
static examples = [`
      $ bf dialog:generate:swagger sandwich.schema --output c:/tmp
    `]

  static args = [
    { name: 'path', required: true, description: 'the path to the swagger file' },
  ]

  static flags: flags.Input = {
    output: flags.string({ char: 'o', description: 'Output path for where to put generated swagger schema files. [default: .]', default: '.', required: false }),
    verbose: flags.boolean({ description: 'Output verbose logging of files as they are processed', default: false }),
    route: flags.string({ char: 'r', description: 'Route to the specific api', required: true }),
    method: flags.string({ char: 'm', description: 'Method of the specific api.', required: true, default: 'GET' }),
    property: flags.string({ char: 'p', description: 'The property of the response to set in', required: true }),
    name: flags.string({ char: 'n', description: 'Define schema name', required: true }),
  }

  async run() {
    const { args, flags } = this.parse(Swagger)
    try {
      let projectName = flags.name
      await swaggerGen.generate(args.path, flags.output, flags.method, flags.route, flags.property, projectName,
        (type, msg) => {
          if (type === gen.FeedbackType.message
            || type === gen.FeedbackType.error
            || (type === gen.FeedbackType.info && flags.verbose)) {
            this.progress(msg)
          }
        });
      let schemaName = ppath.join(flags.output, projectName)
      this.progress(`Schema: ${schemaName}`)
github microsoft / BotBuilder-Samples / experimental / generation / generator / src / commands / dialog / generate / swagger.ts View on Github external
export default class Swagger extends Command {
  static description = '[PREVIEW] Generate localized .lu, .lg, .qna and .dialog assets to define a bot based on a schema using templates.'

  static examples = [`
      $ bf dialog:generate:swagger sandwich.schema --output c:/tmp
    `]

  static args = [
    { name: 'path', required: true, description: 'the path to the swagger file' },
  ]

  static flags: flags.Input = {
    output: flags.string({ char: 'o', description: 'Output path for where to put generated swagger schema files. [default: .]', default: '.', required: false }),
    verbose: flags.boolean({ description: 'Output verbose logging of files as they are processed', default: false }),
    route: flags.string({ char: 'r', description: 'Route to the specific api', required: true }),
    method: flags.string({ char: 'm', description: 'Method of the specific api.', required: true, default: 'GET' }),
    property: flags.string({ char: 'p', description: 'The property of the response to set in', required: true }),
    name: flags.string({ char: 'n', description: 'Define schema name', required: true }),
  }

  async run() {
    const { args, flags } = this.parse(Swagger)
    try {
      let projectName = flags.name
      await swaggerGen.generate(args.path, flags.output, flags.method, flags.route, flags.property, projectName,
        (type, msg) => {
          if (type === gen.FeedbackType.message
            || type === gen.FeedbackType.error
            || (type === gen.FeedbackType.info && flags.verbose)) {
            this.progress(msg)
          }
github microsoft / BotBuilder-Samples / experimental / generation / generator / src / commands / dialog / integrate.ts View on Github external
*/

import { Command, flags } from '@microsoft/bf-cli-command';
import { integrateAssets } from '../../library/integration'
import { FeedbackType } from '../../library/dialogGenerator'

export default class DialogIntegrate extends Command {

    static args = [
        { name: 'schema', required: true, description: 'JSON Schema .schema file used to drive generation.' }
    ]

    static flags: flags.Input = {
        help: flags.help({ char: 'h' }),
        oldPath: flags.string({ char: 'o', description: 'path of old assets ', required: true }),
        newPath: flags.string({ char: 'n', description: 'path of new assets ', required: true }),
        mergedPath: flags.string({ char: 'm', description: 'path of merged assets ', required: true }),
        locale: flags.string({ char: 'l', description: 'locale', required: true }),
        verbose: flags.boolean({ description: 'output verbose logging of files as they are processed', default: false }),
    }

    static examples = [
        '$ bf dialog:integrate aaa -o /bbb -n /ccc -m /ddd -l en-us'
    ]

    async run() {
        const { args, flags } = this.parse(DialogIntegrate)
        try {
            await integrateAssets(args.schema, flags.oldPath, flags.newPath, flags.mergedPath, flags.locale, (type, msg) => {
                if (type === FeedbackType.message
                    || (type === FeedbackType.info && flags.verbose)) {
                    this.info(msg)
github microsoft / BotBuilder-Samples / experimental / generation / generator / src / commands / dialog / generate / swagger.ts View on Github external
export default class Swagger extends Command {
  static description = '[PREVIEW] Generate localized .lu, .lg, .qna and .dialog assets to define a bot based on a schema using templates.'

  static examples = [`
      $ bf dialog:generate:swagger sandwich.schema --output c:/tmp
    `]

  static args = [
    { name: 'path', required: true, description: 'the path to the swagger file' },
  ]

  static flags: flags.Input = {
    output: flags.string({ char: 'o', description: 'Output path for where to put generated swagger schema files. [default: .]', default: '.', required: false }),
    verbose: flags.boolean({ description: 'Output verbose logging of files as they are processed', default: false }),
    route: flags.string({ char: 'r', description: 'Route to the specific api', required: true }),
    method: flags.string({ char: 'm', description: 'Method of the specific api.', required: true, default: 'GET' }),
    property: flags.string({ char: 'p', description: 'The property of the response to set in', required: true }),
    name: flags.string({ char: 'n', description: 'Define schema name', required: true }),
  }

  async run() {
    const { args, flags } = this.parse(Swagger)
    try {
      let projectName = flags.name
      await swaggerGen.generate(args.path, flags.output, flags.method, flags.route, flags.property, projectName,
        (type, msg) => {
          if (type === gen.FeedbackType.message
            || type === gen.FeedbackType.error
            || (type === gen.FeedbackType.info && flags.verbose)) {
            this.progress(msg)
          }
        });
github microsoft / BotBuilder-Samples / experimental / generation / generator / src / commands / dialog / transform.ts View on Github external
/*!
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License.
 */

import { Command, flags } from '@microsoft/bf-cli-command';
import * as fs from 'fs-extra';
import * as ppath from 'path';

export default class DialogTransform extends Command {

    static flags: flags.Input = {
        help: flags.help({ char: 'h' }),
        schemaName: flags.string({ char: 's', description: 'schemaName' }),
        input: flags.string({ char: 'i', description: 'input path' }),
        output: flags.string({ char: 'o', description: 'output path' }),
    }

    async run() {
        const { argv, flags } = this.parse(DialogTransform)

        await this.transformDialog(flags.schemaName, flags.input, flags.output)
    }

    /**
    feedback(FeedbackType.info, `*** Old and new both changed, manually merge from ${ppath.join(path, fileName)} ***`)	 * @description:Get all file paths from the specific dir.
 * @param dir Root dir.
 * @param fileList List of file paths.
 */
    getFiles(dir: string, fileList: string[]) {
github microsoft / BotBuilder-Samples / experimental / generation / generator / src / commands / dialog / generate.ts View on Github external
export default class GenerateDialog extends Command {
    static description = '[PREVIEW] Generate localized .lu, .lg, .qna and .dialog assets to define a bot based on a schema using templates.'

    static examples = [`
      $ bf dialog:generate sandwich.schema --output c:/tmp
    `]

    static args = [
        { name: 'schema', required: true, description: 'JSON Schema .schema file used to drive generation.' }
    ]

    static flags: flags.Input = {
        debug: flags.boolean({ description: 'Show extra debugging information.' }),
        force: flags.boolean({ char: 'f', description: 'Force overwriting generated files.' }),
        help: flags.help({ char: 'h' }),
        locale: flags.string({ char: 'l', description: 'Locales to generate. [default: en-us]', multiple: true }),
        merge: flags.boolean({ description: 'Merge generated results into output directory.', default: false }),
        output: flags.string({ char: 'o', description: 'Output path for where to put generated .lu, .lg, .qna and .dialog files.', default: '.', required: false }),
        prefix: flags.string({ char: 'p', description: 'Prefix to use for generated files. [default: schema name]' }),
        schema: flags.string({ char: 's', description: 'Path to your app.schema file.', required: false }),
        singleton: flags.boolean({ description: 'Specify to generate a single .dialog file.' }),
        templates: flags.string({ char: 't', description: 'Directory with templates to use for generating assets.  With multiple directories, the first definition found wins.  To include the standard templates, just use "standard" as a template directory name.', multiple: true }),
        verbose: flags.boolean({ description: 'Output verbose logging of files as they are processed', default: false }),
    }

    async run() {
        const { args, flags } = this.parse(GenerateDialog)
        let feedback = (type: gen.FeedbackType, msg: string) => {
            if (type === gen.FeedbackType.message
                || (type === gen.FeedbackType.info && flags.verbose)) {
                this.info(msg)
            } else if (type === gen.FeedbackType.warning) {
github microsoft / BotBuilder-Samples / experimental / generation / generator / src / commands / dialog / generate.ts View on Github external
$ bf dialog:generate sandwich.schema --output c:/tmp
    `]

    static args = [
        { name: 'schema', required: true, description: 'JSON Schema .schema file used to drive generation.' }
    ]

    static flags: flags.Input = {
        debug: flags.boolean({ description: 'Show extra debugging information.' }),
        force: flags.boolean({ char: 'f', description: 'Force overwriting generated files.' }),
        help: flags.help({ char: 'h' }),
        locale: flags.string({ char: 'l', description: 'Locales to generate. [default: en-us]', multiple: true }),
        merge: flags.boolean({ description: 'Merge generated results into output directory.', default: false }),
        output: flags.string({ char: 'o', description: 'Output path for where to put generated .lu, .lg, .qna and .dialog files.', default: '.', required: false }),
        prefix: flags.string({ char: 'p', description: 'Prefix to use for generated files. [default: schema name]' }),
        schema: flags.string({ char: 's', description: 'Path to your app.schema file.', required: false }),
        singleton: flags.boolean({ description: 'Specify to generate a single .dialog file.' }),
        templates: flags.string({ char: 't', description: 'Directory with templates to use for generating assets.  With multiple directories, the first definition found wins.  To include the standard templates, just use "standard" as a template directory name.', multiple: true }),
        verbose: flags.boolean({ description: 'Output verbose logging of files as they are processed', default: false }),
    }

    async run() {
        const { args, flags } = this.parse(GenerateDialog)
        let feedback = (type: gen.FeedbackType, msg: string) => {
            if (type === gen.FeedbackType.message
                || (type === gen.FeedbackType.info && flags.verbose)) {
                this.info(msg)
            } else if (type === gen.FeedbackType.warning) {
                this.warning(msg)
            } else if (type === gen.FeedbackType.error) {
                this.errorMsg(msg)
            } else if (type === gen.FeedbackType.debug && flags.debug) {
github microsoft / BotBuilder-Samples / experimental / generation / generator / src / commands / dialog / generate.ts View on Github external
static examples = [`
      $ bf dialog:generate sandwich.schema --output c:/tmp
    `]

    static args = [
        { name: 'schema', required: true, description: 'JSON Schema .schema file used to drive generation.' }
    ]

    static flags: flags.Input = {
        debug: flags.boolean({ description: 'Show extra debugging information.' }),
        force: flags.boolean({ char: 'f', description: 'Force overwriting generated files.' }),
        help: flags.help({ char: 'h' }),
        locale: flags.string({ char: 'l', description: 'Locales to generate. [default: en-us]', multiple: true }),
        merge: flags.boolean({ description: 'Merge generated results into output directory.', default: false }),
        output: flags.string({ char: 'o', description: 'Output path for where to put generated .lu, .lg, .qna and .dialog files.', default: '.', required: false }),
        prefix: flags.string({ char: 'p', description: 'Prefix to use for generated files. [default: schema name]' }),
        schema: flags.string({ char: 's', description: 'Path to your app.schema file.', required: false }),
        singleton: flags.boolean({ description: 'Specify to generate a single .dialog file.' }),
        templates: flags.string({ char: 't', description: 'Directory with templates to use for generating assets.  With multiple directories, the first definition found wins.  To include the standard templates, just use "standard" as a template directory name.', multiple: true }),
        verbose: flags.boolean({ description: 'Output verbose logging of files as they are processed', default: false }),
    }

    async run() {
        const { args, flags } = this.parse(GenerateDialog)
        let feedback = (type: gen.FeedbackType, msg: string) => {
            if (type === gen.FeedbackType.message
                || (type === gen.FeedbackType.info && flags.verbose)) {
                this.info(msg)
            } else if (type === gen.FeedbackType.warning) {
                this.warning(msg)
            } else if (type === gen.FeedbackType.error) {
                this.errorMsg(msg)
github microsoft / BotBuilder-Samples / experimental / generation / generator / src / commands / dialog / transform.ts View on Github external
/*!
 * Copyright (c) Microsoft Corporation. All rights reserved.
 * Licensed under the MIT License.
 */

import { Command, flags } from '@microsoft/bf-cli-command';
import * as fs from 'fs-extra';
import * as ppath from 'path';

export default class DialogTransform extends Command {

    static flags: flags.Input = {
        help: flags.help({ char: 'h' }),
        schemaName: flags.string({ char: 's', description: 'schemaName' }),
        input: flags.string({ char: 'i', description: 'input path' }),
        output: flags.string({ char: 'o', description: 'output path' }),
    }

    async run() {
        const { argv, flags } = this.parse(DialogTransform)

        await this.transformDialog(flags.schemaName, flags.input, flags.output)
    }

    /**
    feedback(FeedbackType.info, `*** Old and new both changed, manually merge from ${ppath.join(path, fileName)} ***`)	 * @description:Get all file paths from the specific dir.
 * @param dir Root dir.
 * @param fileList List of file paths.
 */
    getFiles(dir: string, fileList: string[]) {
        fileList = fileList || []
        let files = fs.readdirSync(dir)

@microsoft/bf-cli-command

base class for Microsoft Bot Framework CLI commands

MIT
Latest version published 2 years ago

Package Health Score

61 / 100
Full package analysis