yargs#argv TypeScript Examples

The following examples show how to use yargs#argv. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: removeBuilder.ts    From ctix with MIT License 6 votes vote down vote up
export default function removeBuilder<
  T extends TRemoveOption | TCreateOption | TInitOption | TSingleOption,
>(args: Argv<T>) {
  args.option('includeBackup', {
    alias: 'b',
    describe: 'clean with backup file',
    type: 'boolean',
  });

  return args;
}
Example #2
Source File: index.ts    From yaclt with Mozilla Public License 2.0 6 votes vote down vote up
BuildCli = (): Argv => {
  const cli = yargs(hideBin(process.argv)).scriptName("yaclt");

  // register middlewares
  cli
    .middleware(
      ValidateArgvMiddleware.handler,
      ValidateArgvMiddleware.preValidation
    )
    .middleware(
      CallFunctionArgsMiddleware.handler,
      CallFunctionArgsMiddleware.preValidation
    )
    .middleware(
      TemplatesFromFilesMiddleware.handler,
      TemplatesFromFilesMiddleware.preValidation
    )
    .middleware(
      LastCommitMessageMiddleware.handler,
      LastCommitMessageMiddleware.preValidation
    )
    .middleware(LogLevelMiddleware.handler, LogLevelMiddleware.preValidation);

  cli.version(versionInfo);

  for (const command of Commands) {
    cli.command(command);
  }

  cli
    .completion()
    .demandCommand()
    .recommendCommands()
    .strictCommands()
    .config(config);

  return cli;
}
Example #3
Source File: fetch.ts    From bdk with Apache License 2.0 6 votes vote down vote up
builder = (yargs: Argv<OptType>) => {
  return yargs
    .example('bdk channel fetch --interactive', 'Cathay BDK 互動式問答')
    .option('interactive', { type: 'boolean', description: '是否使用 Cathay BDK 互動式問答', alias: 'i' })
    .option('orderer', { type: 'string', choices: ordererList, description: '選擇 Orderer 建立 Channel', alias: 'o' })
    .option('name', { type: 'string', description: '建立 Channel 的名稱', alias: 'n' })
    .option('config-style', { type: 'string', choices: Object.values(ChannelConfigEnum), description: '欲匯出的 block 種類', alias: 't' })
    .option('output-file-name', { type: 'string', description: '匯出取得 Channel 上資訊的檔案名稱', alias: 'f' })
}
Example #4
Source File: Runner.ts    From mpflow with MIT License 6 votes vote down vote up
protected _registerCommand(
    command: CommandModule['command'],
    describe: CommandModule['describe'],
    builder: (args: Argv<any>) => Argv<any>,
    handler: (args: any) => void,
  ): void {
    const chalk = require('chalk') as typeof import('chalk')
    this.program.command({
      command,
      describe,
      handler: args => {
        this._commandPromise = (async () => {
          try {
            await handler(args as any)
          } catch (e) {
            console.error(chalk.red(e))
            process.exit(1)
          } finally {
            this._commandPromise = null
          }
        })()
      },
      builder,
    })
  }
Example #5
Source File: seed.ts    From typeorm-extension with MIT License 6 votes vote down vote up
builder(args: Argv) {
        return args
            .option('root', {
                alias: 'r',
                default: process.cwd(),
                describe: 'Path to the data-source / config file.',
            })
            .option('connection', {
                alias: 'c',
                default: 'default',
                describe: 'Name of the connection on which run a query.',
                deprecated: true,
            })
            .option('config', {
                alias: 'f',
                default: 'ormconfig',
                describe: 'Name of the file with the data-source configuration.',
                deprecated: true,
            })
            .option('dataSource', {
                alias: 'd',
                default: 'data-source',
                describe: 'Name of the file with the data-source.',
            })
            .option('seed', {
                alias: 's',
                describe: 'Specify the seed class to run.',
            });
    }
Example #6
Source File: singleBuilder.ts    From ctix with MIT License 6 votes vote down vote up
export default function singleBuilder<
  T extends TRemoveOption | TCreateOption | TInitOption | TSingleOption,
>(args: Argv<T>) {
  args
    .option('useRootDir', {
      alias: 'r',
      describe: 'output file under rootDir in tsconfig.json',
      type: 'boolean',
    })
    .option('output', {
      alias: 'o',
      describe: 'output directory',
      type: 'string',
    });

  return args;
}
Example #7
Source File: up.ts    From bdk with Apache License 2.0 6 votes vote down vote up
builder = (yargs: Argv<OptType>) => {
  return yargs
    .option('interactive', { type: 'boolean', description: '是否使用 Cathay BDK 互動式問答', alias: 'i', default: false })
    .option('user', { type: 'string', description: 'explorer 的預設使用者名稱', alias: 'u', default: 'exploreradmin' })
    .option('pass', { type: 'string', description: 'explorer 的預設使用者密碼', alias: 'p', default: 'exploreradminpw' })
    .option('port', { type: 'number', description: 'explorer 的預設使用者名稱', alias: 'P', default: 8080 })
    .example('bdk explorer up --interactive', 'Cathay BDK 互動式問答')
    .example('bdk explorer up --user alice --pass pass123 --port 8080', '建立 explore ,使用者帳號為 alice ,密碼為 pass123 ,使用的 port 是 8080')
}
Example #8
Source File: init.ts    From OpenVolunteerPlatform with MIT License 6 votes vote down vote up
builder = (args: Argv) => {
  args.positional('name', {
    describe: 'Project name',
    type: 'string',
  })
  args.option('templateName', {
    describe: 'Name of the predefined template',
    type: 'string'
  })
  args.option('templateUrl', {
    describe: 'GitHub URL of the template. For example (http://github.com/wtrocki/hapijs#master)',
    type: 'string'
  })
}
Example #9
Source File: createSingleBuilder.ts    From ctix with MIT License 6 votes vote down vote up
export default function createSingleBuilder<
  T extends TRemoveOption | TCreateOption | TInitOption | TSingleOption,
>(args: Argv<T>) {
  args
    .option('useSemicolon', {
      alias: 's',
      describe: 'add semicolon on every export statement',
      type: 'boolean',
    })
    .option('useTimestamp', {
      alias: 't',
      describe:
        'timestamp write on ctix comment right-side, only works in useComment option set true',
      type: 'boolean',
    })
    .option('useComment', {
      alias: 'm',
      describe:
        'add ctix comment at first line of creted index.ts file, that remark created from ctix',
      type: 'boolean',
    })
    .option('quote', {
      alias: 'q',
      describe: 'change quote character at export syntax',
      type: 'string',
    })
    .option('overwrite', {
      alias: 'w',
      describe: 'overwrite each index.ts file',
      type: 'boolean',
    })
    .option('keepFileExt', {
      alias: 'k',
      describe: 'keep file extension in export statement path',
      type: 'boolean',
    });

  return args;
}
Example #10
Source File: create.ts    From bdk with Apache License 2.0 6 votes vote down vote up
builder = (yargs: Argv<OptType>) => {
  return yargs
    .example('bdk network create --interactive', 'Cathay BDK 互動式問答')
    .example('bdk network create --file ~/.bdk/network-create.json --create-full', '使用在路徑下 json 檔案中的參數,產生 Blockchain network 所需的相關設定檔案')
    .example('bdk network create --file ~/.bdk/network-create.json --cryptogen', '使用在路徑下 json 檔案中的參數和 cryptogen,產生憑證和私鑰')
    .example('bdk network create --file ~/.bdk/network-create.json --genesis', '使用在路徑下 json 檔案中的參數,產生創始區塊')
    .example('bdk network create --file ~/.bdk/network-create.json --connection-profile', '使用在路徑下 json 檔案中的參數,產生 Peer 連接設定檔案')
    .example('bdk network create --file ~/.bdk/network-create.json --docker-compose', '使用在路徑下 json 檔案中的參數,產生 Peer/Orderer docker-compose 檔案')
    .option('file', { type: 'string', description: '需要的參數設定 json 檔案路徑', alias: 'f' })
    .option('interactive', { type: 'boolean', description: '是否使用 Cathay BDK 互動式問答', alias: 'i', default: false })
    .option('create-full', { type: 'boolean', description: '是否產生 Blockchain network 所需要的所有相關設定檔案(包含使用 cryptogen 產生憑證和私鑰、產生創始區塊、產生 Peer 連接設定檔案、產生 Peer/Orderer docker-compose 檔案)', default: false })
    .option('cryptogen', { type: 'boolean', description: '是否使用 cryptogen 產生憑證和私鑰', default: false })
    .option('genesis', { type: 'boolean', description: '是否產生創始區塊', default: false })
    .option('connection-profile', { type: 'boolean', description: '是否產生 Peer 連接設定檔案', default: false })
    .option('docker-compose', { type: 'boolean', description: '是否產生 Peer/Orderer docker-compose 檔案', default: false })
    .option('test-network', { type: 'boolean', description: '建立測試用的 Blockchain Network', default: false })
}
Example #11
Source File: createBuilder.ts    From ctix with MIT License 6 votes vote down vote up
export default function singleBuilder<
  T extends TRemoveOption | TCreateOption | TInitOption | TSingleOption,
>(args: Argv<T>) {
  args.option('skipEmptyDir', {
    alias: 'e',
    describe: 'If set true this option, skip empty directory',
    type: 'boolean',
  });

  return args;
}
Example #12
Source File: add.ts    From bdk with Apache License 2.0 6 votes vote down vote up
builder = (yargs: Argv<OptType>) => {
  return yargs
    .example('bdk org orderer add consenter --interactive', 'Cathay BDK 互動式問答')
    .example('bdk org orderer add consenter --orderer orderer0.example.com:7050 -channel-name test --org-name OrdererOrg3 --hostname orderer0', '使用 orderer0.example.com:7050 的 Orderer 將 OrdererOrg3 中 Hostname 名稱為 orderer0 的設定檔資訊加入 Channel 名稱為 test中並且使用當下身份簽章')
    .option('interactive', { type: 'boolean', description: '是否使用 Cathay BDK 互動式問答', alias: 'i' })
    .option('orderer', { type: 'string', choices: ordererList, description: '選擇使用的 Orderer', alias: 'o' })
    .option('channel-name', { type: 'string', choices: channelList, description: 'Orderer Org 加入 Channel 的名稱', alias: 'c' })
    .option('org-name', { type: 'string', description: '欲加入 Channel 中 Orderer Org 的名稱', alias: 'n' })
    .option('hostname', { type: 'string', description: '欲加入 Channel 中 Orderer 的 hostname', alias: 'h' })
}
Example #13
Source File: generateTestSourceWithMobx.ts    From reactant with MIT License 6 votes vote down vote up
{
  classAmount = 50,
  oneClassReducerAmount = 10,
  computedTime = (50000 / classAmount) | 0, // 1000 -> Run out of memory
  allCheckedState = true,
} = argv.mode ? {
  small: {
    classAmount: 100,
    oneClassReducerAmount: 20,
    computedTime: 1000,
    allCheckedState: true,
  },
  big: {
    classAmount: 200,
    oneClassReducerAmount: 30,
    computedTime: 1000,
    allCheckedState: true,
  },
  huge: {
    classAmount: 300,
    oneClassReducerAmount: 100,
    computedTime: 1000,
    allCheckedState: true,
  },
  // @ts-ignore
}[argv.mode] : (argv as any)
Example #14
Source File: enroll.ts    From bdk with Apache License 2.0 6 votes vote down vote up
builder = (yargs: Argv) => {
  return yargs
    .example('bdk ca enroll --interactive', 'Cathay BDK 互動式問答')
    .example('bdk ca enroll -t client -u rca -p 7054 --client-id admin --client-secret adminpw --role rca --org-hostname rca', '登入名稱為 rca 的 CA 機器')
    .option('interactive', { alias: 'i', describe: '是否使用 Cathay BDK 互動式問答', type: 'boolean' })
    .option('type', { alias: 't', describe: 'enrollment type - required', type: 'string', default: 'client' })
    .option('upstream', { alias: 'u', describe: 'enrollment upstream host - required', type: 'string' })
    .option('upstream-port', { alias: 'p', describe: 'enrollment upstream port - required', type: 'number', default: 7054 })
    .option('client-id', { describe: 'client id to enroll with - required', type: 'string' })
    .option('client-secret', { describe: 'secret corresponding to client id specified - required', type: 'string' })
    .option('role', { alias: 'r', describe: 'ca type rca, peer org or orderer org - required', type: 'string', default: 'rca' })
    .option('org-hostname', { alias: 'h', describe: 'enroll org hostname - required', type: 'string' })
    // .option('tls-certfile', { describe: 'tls certfile of upstream - required', type: 'string' })
}
Example #15
Source File: generateTestSourceWithPlain.ts    From reactant with MIT License 6 votes vote down vote up
{
  classAmount = 50,
  oneClassReducerAmount = 10,
  computedTime = (50000 / classAmount) | 0, // 1000 -> Run out of memory
  allCheckedState = true,
} = argv.mode ? {
  small: {
    classAmount: 100,
    oneClassReducerAmount: 20,
    computedTime: 1000,
    allCheckedState: true,
  },
  big: {
    classAmount: 200,
    oneClassReducerAmount: 30,
    computedTime: 1000,
    allCheckedState: true,
  },
  huge: {
    classAmount: 300,
    oneClassReducerAmount: 100,
    computedTime: 1000,
    allCheckedState: true,
  },
  // @ts-ignore
}[argv.mode] : (argv as any)
Example #16
Source File: create.ts    From bdk with Apache License 2.0 6 votes vote down vote up
builder = (yargs: Argv<OptType>) => {
  return yargs
    .example('bdk channel create --interactive', 'Cathay BDK 互動式問答')
    .example('bdk channel create --name test --orderer orderer0.example.com:7050 --orgNames Org1 --orgNames Org2', '使用 orderer0.example.com:7050 建立有 Org1 和 Org2 的 test 名稱 Channel')
    .example('bdk channel create --name test --orderer orderer0.example.com:7050 --orgNames Org1 --orgNames Org2 --channel-admin-policy-style Any-Member-in-Channel', '使用 orderer0.example.com:7050 建立有 Org1 和 Org2 的 test 名稱 Channel,其中 Channel Admin Policy 為有任何在 Channel 中的 Peer Org 簽名選項')
    .example('bdk channel create --name test --orderer orderer0.example.com:7050 --orgNames Org1 --orgNames Org2 --channel-admin-policy-type Signature --channel-admin-policy-value OR(\'Org1.admin\', \'Org2.admin\')', '使用 orderer0.example.com:7050 建立有 Org1 和 Org2 的 test 名稱 Channel,其中 Channel Admin Policy 為有 Org1 和 Org2 任意一個 admin 身份的簽名')
    .example('bdk channel create --name test --orderer orderer0.example.com:7050 --orgNames Org1 --orgNames Org2 --lifecycle-endorsement-style Any-Member-in-Channel', '使用 orderer0.example.com:7050 建立有 Org1 和 Org2 的 test 名稱 Channel,其中 Lifecycle Endorsement Policy 為有任何在 Channel 中的 Peer Org 簽名選項')
    .example('bdk channel create --name test --orderer orderer0.example.com:7050 --orgNames Org1 --orgNames Org2 --lifecycle-endorsement-type Signature --lifecycle-endorsement-value OR(\'Org1.admin\', \'Org2.admin\')', '使用 orderer0.example.com:7050 建立有 Org1 和 Org2 的 test 名稱 Channel,其中 Lifecycle Endorsement Policy 為有 Org1 和 Org2 任意一個 peer 身份的簽名')
    .example('bdk channel create --name test --orderer orderer0.example.com:7050 --orgNames Org1 --orgNames Org2 --endorsement-style Any-Member-in-Channel', '使用 orderer0.example.com:7050 建立有 Org1 和 Org2 的 test 名稱 Channel,其中 Endorsement Policy 為有任何在 Channel 中的 Peer Org 簽名選項')
    .example('bdk channel create --name test --orderer orderer0.example.com:7050 --orgNames Org1 --orgNames Org2 --endorsement-type Signature --endorsement-value OR(\'Org1.admin\', \'Org2.admin\')', '使用 orderer0.example.com:7050 建立有 Org1 和 Org2 的 test 名稱 Channel,其中 Endorsement Policy 為有 Org1 和 Org2 任意一個 peer 身份的簽名')
    .option('interactive', { type: 'boolean', description: '是否使用 Cathay BDK 互動式問答', alias: 'i' })
    .option('name', { type: 'string', description: '建立 Channel 的名稱', alias: 'n' })
    .option('orgNames', { type: 'array', choices: orgNames, description: '加入新建立 Channel 的 Peer Org 名稱', alias: 'o' })
    .option('channel-admin-policy-style', { type: 'string', choices: Object.values(PolicyStyleEnum), description: '選擇新建立 Channel 中基本的 Channel Admin Policy 選項(像是用在新 Peer Org 加入在 Channel 中的 Policy)', alias: 'as' })
    .option('channel-admin-policy-type', { type: 'string', choices: Object.values(PolicyTypeEnum), description: '選擇新建立 Channel 中的 Channel Admin Policy 型態', alias: 'at', default: PolicyTypeEnum.IMPLICITMETA })
    .option('channel-admin-policy-value', { type: 'string', description: '新建立 Channel 中的 Channel Admin Policy 值', alias: 'a', default: 'MAJORITY Admins' })
    .option('lifecycle-endorsement-style', { type: 'string', choices: Object.values(PolicyStyleEnum), description: '選擇新建立 Channel 中基本的 Lifcycle Endorsement Policy 選項(用在部署新的 Chaincode 在 Channel 中的 Policy)', alias: 'ls' })
    .option('lifecycle-endorsement-type', { type: 'string', choices: Object.values(PolicyTypeEnum), description: '選擇新建立 Channel 中的 Lifcycle Endorsement Policy 型態', alias: 'lt', default: PolicyTypeEnum.IMPLICITMETA })
    .option('lifecycle-endorsement-value', { type: 'string', description: '新建立 Channel 中的 Lifcycle Endorsement Policy 值', alias: 'l', default: 'MAJORITY Endorsement' })
    .option('endorsement-style', { type: 'string', choices: Object.values(PolicyStyleEnum), description: '選擇新建立 Channel 中基本的 Endorsement Policy 選項(用在發送交易在 Channel 中的 Policy)', alias: 'es' })
    .option('endorsement-type', { type: 'string', choices: Object.values(PolicyTypeEnum), description: '選擇新建立 Channel 中的 Endorsement Policy 型態', alias: 'et', default: PolicyTypeEnum.IMPLICITMETA })
    .option('endorsement-value', { type: 'string', description: '新建立 Channel 中的 Endorsement Policy 值', alias: 'e', default: 'MAJORITY Endorsement' })
    .option('orderer', { type: 'string', choices: ordererList, description: '選擇 Orderer 建立 Channel' })
}
Example #17
Source File: init.d.ts    From OpenVolunteerPlatform with MIT License 5 votes vote down vote up
builder: (args: Argv<{}>) => void
Example #18
Source File: peer.ts    From bdk with Apache License 2.0 5 votes vote down vote up
builder = (yargs: Argv) => {
  return yargs.commandDir('peer').demandCommand()
}
Example #19
Source File: tsuml2-settings.ts    From TsUML2 with MIT License 5 votes vote down vote up
fromArgs(yargs: Argv) {

        const argv = yargs.option('glob', {
            alias: "g",
            describe: "pattern to match the source files (i.e.: ./src/**/*.ts)",
            string: true,
            required: true
        }).option('tsconfig',{
            default: this.tsconfig,
            describe: "the path to tsconfig.json file"
        }).option('outFile', {
            alias: "o",
            describe: "the path to the output file",
            default: this.outFile,
        }).option('propertyTypes', {
            default: this.propertyTypes,
            describe: "show property types and method return types",
            boolean: true
        }).option('modifiers', {
            default: this.modifiers,
            describe: "show modifiers like public,protected,private,static",
            boolean: true
        }).option('typeLinks', {
            default: this.typeLinks,
            describe: "add links for classes, interface, enums that point to the source files",
            boolean: true
        }).option('nomnoml', {
            describe: "nomnoml layouting and styling options (an array of strings, each representing a nomnoml line), i.e.: --nomnoml \"#arrowSize: 1\" \"#.interface: fill=#8f8 dashed\" ",
            array: true,
            string: true
        }).option('outDsl', {
            describe: "the path to the output DSL file (nomnoml)",
            string: true,
            required: false,
        }).option('config', {
            describe: "path to a json config file (command line options can be provided as keys in it)",
            string: true
        }).argv as Partial<TsUML2Settings & { config: string}>;

        if (argv.config) {
            //parse and apply the config file
            const config = fs.readFileSync(argv.config).toString();
            this.formJSON(config);
        }

        if(argv.glob) {
            this.glob = argv.glob;
        }

        if(argv.tsconfig && !(yargs.parsed as any).defaulted.tsconfig) {
            this.tsconfig = argv.tsconfig;
        }

        if(argv.outFile && !(yargs.parsed as any).defaulted.outFile) {
            this.outFile = argv.outFile;
        }
       
        if(argv.nomnoml) {
            this.nomnoml = argv.nomnoml;
        }

        if(argv.modifiers != null && !(yargs.parsed as any).defaulted.modifiers) {
            this.modifiers = argv.modifiers;
        }

        if(argv.propertyTypes != null && !(yargs.parsed as any).defaulted.propertyTypes) {
            this.propertyTypes = argv.propertyTypes;
        }

        if(argv.typeLinks != null && !(yargs.parsed as any).defaulted.typeLinks) {
            this.typeLinks = argv.typeLinks;
        }

        if(argv.outDsl != null && !(yargs.parsed as any).defaulted.outDsl) {
            this.outDsl = argv.outDsl;
        }
    }
Example #20
Source File: constants.ts    From react-typescript-boilerplate with MIT License 5 votes vote down vote up
ENABLE_OPEN = argv.open as true | string
Example #21
Source File: initBuilder.ts    From ctix with MIT License 5 votes vote down vote up
export default function initBuilder<
  T extends TRemoveOption | TCreateOption | TInitOption | TSingleOption,
>(args: Argv<T>) {
  args
    // remove only
    .option('includeBackup', {
      describe: 'clean with backup file',
      type: 'boolean',
    })
    // single only
    .option('useRootDir', {
      describe: 'output file under rootDir in tsconfig.json',
      type: 'boolean',
    })
    .option('output', {
      describe: 'output directory',
      type: 'string',
    })
    // create only
    .option('skipEmptyDir', {
      describe: 'If set true this option, skip empty directory',
      type: 'boolean',
    })
    // create, single common
    .option('useSemicolon', {
      describe: 'add semicolon on every export statement',
      type: 'boolean',
    })
    .option('useTimestamp', {
      describe:
        'timestamp write on ctix comment right-side, only works in useComment option set true',
      type: 'boolean',
    })
    .option('useComment', {
      describe:
        'add ctix comment at first line of creted index.ts file, that remark created from ctix',
      type: 'boolean',
    })
    .option('quote', {
      describe: 'change quote character at export syntax',
      type: 'string',
    })
    .option('useBackupFile', {
      describe: 'created backup file if exists index.ts file already in directory',
      type: 'boolean',
    })
    .option('keepFileExt', {
      describe: 'keep file extension in export statement path',
      type: 'boolean',
    });

  return args;
}
Example #22
Source File: index.ts    From electron-playground with MIT License 5 votes vote down vote up
console.log(argv)
Example #23
Source File: cli.ts    From ctix with MIT License 5 votes vote down vote up
yargs: Argv<TRemoveOption | TCreateOption | TInitOption | TSingleOption> =
  yargsAnyType as any
Example #24
Source File: build.ts    From js-client with MIT License 5 votes vote down vote up
BUILD_ENVIRONMENTS = ((): Array<BuildEnvironment> => {
	if (argv.nodeOnly) return ['Node'];
	if (argv.browsersOnly) return ['Browsers'];
	return ['Node', 'Browsers'];
})()
Example #25
Source File: Runner.ts    From mpflow with MIT License 5 votes vote down vote up
/**
   * CLI 操作对象
   */
  public program: Argv
Example #26
Source File: build.ts    From js-client with MIT License 5 votes vote down vote up
QUIET: boolean = !!argv.quiet || !!argv.q
Example #27
Source File: chaincode.ts    From bdk with Apache License 2.0 5 votes vote down vote up
builder = (yargs: Argv) => {
  return yargs.commandDir('chaincode').demandCommand()
}
Example #28
Source File: start.ts    From noether with Apache License 2.0 5 votes vote down vote up
builder = (yargs: Argv) => {
    return yargs
        .option("url", {
            describe: "URL of the Ethereum node",
            default: process.env.URL || "http://localhost:8545",
        })
        .option("wallet", {
            describe: "Filename of JSON wallet file",
            type: "string",
        })
        .option("accountIndex", {
            describe: "Account index from server to use",
            default: 0,
        })
        .option("gasPrice", {
            describe: "Gas price predictor strategy",
            default: process.env.GAS_PRICE_PROVIDER || "eth-provider",
            demandOption: true,
            choices: gasPriceProviderTypes,
        })
        .option("gasStationAPIKey", {
            describe: "Gas Station API Key",
            default: process.env.GAS_STATION_API_KEY,
        })
        .option("create", {
            describe: "Create a wallet if it doesn't exist",
            type: "boolean",
            alias: "c",
            default: false,
        })
        .option("monitoring", {
            describe: "Start monitoring server",
            type: "boolean",
            alias: "m",
            default: false,
        })
        .option("hostname", {
            describe: "Host of monitoring server",
            type: "string",
            alias: "h",
            default: "127.0.0.1",
        })
        .option("port", {
            describe: "Port of monitoring server",
            type: "number",
            alias: "p",
            default: 9860,
        })
        .option("verbose", {
            type: "boolean",
            alias: "v",
            default: false,
        });
}
Example #29
Source File: add.ts    From bdk with Apache License 2.0 5 votes vote down vote up
builder = (yargs: Argv<OptType>) => {
  return yargs
    .example('bdk orderer add --interactive', 'Cathay BDK 互動式問答')
    .example('bdk orderer add --orderer-hostnames orderer1', '在名稱為 BDK_ORG_DOMAIN 的 Orderer org 新增 Hostname 為 orderer1 的 Orderer')
    .option('interactive', { type: 'boolean', description: '是否使用 Cathay BDK 互動式問答', alias: 'i' })
    .option('orderer-hostnames', { type: 'array', description: '新增 Orderer 的 Hostname', alias: 'h' })
}