• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript commander.version函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中commander.version函数的典型用法代码示例。如果您正苦于以下问题:TypeScript version函数的具体用法?TypeScript version怎么用?TypeScript version使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了version函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: function

module.exports = function (argv: string[]): void {
	program
		.version(pkg.version);

	program
		.command('ls')
		.description('Lists all the files that will be published')
		.action(() => main(ls()));

	program
		.command('package')
		.description('Packages an extension')
		.option('-o, --out [path]', 'Location of the package')
		.option('--baseContentUrl [url]', 'Prepend all relative links in README.md with this url.')
		.option('--baseImagesUrl [url]', 'Prepend all relative image links in README.md with this url.')
		.action(({ out, baseContentUrl, baseImagesUrl }) => main(packageCommand({ packagePath: out, baseContentUrl, baseImagesUrl })));

	program
		.command('publish [<version>]')
		.description('Publishes an extension')
		.option('-p, --pat <token>', 'Personal Access Token')
		.option('--packagePath [path]', 'Publish the VSIX package located at the specified path.')
		.option('--baseContentUrl [url]', 'Prepend all relative links in README.md with this url.')
		.option('--baseImagesUrl [url]', 'Prepend all relative image links in README.md with this url.')
		.action((version, { pat, packagePath, baseContentUrl, baseImagesUrl }) => main(publish({ pat, version, packagePath, baseContentUrl, baseImagesUrl })));

	program
		.command('unpublish [<extensionid>]')
		.description('Unpublishes an extension. Example extension id: microsoft.csharp.')
		.option('-p, --pat <token>', 'Personal Access Token')
		.action((id, { pat }) => main(unpublish({ id, pat })));

	program
		.command('list <publisher>')
		.description('Lists all extensions published by the given publisher')
		.action(publisher => main(list(publisher)));

	program
		.command('ls-publishers')
		.description('List all known publishers')
		.action(() => main(listPublishers()));

	program
		.command('create-publisher <publisher>')
		.description('Creates a new publisher')
		.action(publisher => main(createPublisher(publisher)));

	program
		.command('delete-publisher <publisher>')
		.description('Deletes a publisher')
		.action(publisher => main(deletePublisher(publisher)));

	program
		.command('login <publisher>')
		.description('Add a publisher to the known publishers list')
		.action(name => main(loginPublisher(name)));

	program
		.command('logout <publisher>')
		.description('Remove a publisher from the known publishers list')
		.action(name => main(logoutPublisher(name)));

	program
		.command('*')
		.action(() => program.help());

	program.parse(argv);

	if (process.argv.length <= 2) {
		program.help();
	}
};
开发者ID:rlugojr,项目名称:vscode-vsce,代码行数:72,代码来源:main.ts


示例2: catch

  if (typeof(path) === 'undefined' || typeof(val) === 'undefined') {
    // tslint:disable-next-line
    console.warn('Invalid format for invalid config. Correct is -> jsonpath=value');
    return opts;
  }
  try {
    jp.parse(path);
  } catch (e) {
    // tslint:disable-next-line
    console.warn('JSONPath is invalid', e);
  }
  opts.push({ path, val });
  return opts;
};

program
  .version(packageJson)
  .option('-n, --net <network>', 'network: mainnet, testnet', 'mainnet')
  .option('-p, --port <port>', 'listening port number')
  .option('-a, --address <ip>', 'listening host name or ip')
  .option('-x, --peers [peers...]', 'peers list')
  .option('-l, --log <level>', 'log level')
  .option('-s, --snapshot [round]', 'verify snapshot')
  .option('-c, --config <path>', 'custom config path')
  .option('-e, --extra-config <path>', 'partial override config path')
  .option('-o, --override-config <item>', 'Override single config item', overrideFn)
  .option('-C --override-constant <item>', 'Override constants for testing purposes', overrideFn)
  .parse(process.argv);

// tslint:disable-next-line
const genesisBlock: SignedAndChainedBlockType = require(`../etc/${program.net}/genesisBlock.json`);
开发者ID:RiseVision,项目名称:rise-node,代码行数:31,代码来源:app.ts


示例3: parseInt

/// <reference path="../typings/index.d.ts" />

// Startup script for running BST
import {BespokeServer} from "../lib/server/bespoke-server";
import * as program from "commander";
import {Global} from "../lib/core/global";

program.version(Global.version());

program
    .command("start <webhookPort> <nodePort>")
    .description("Starts the BST server")
    .action(function (nodeID: string, port: number, options: any) {
        let webhookPort: number = parseInt(process.argv[3]);
        let serverPort: number = parseInt(process.argv[4]);
        let bespokeServer = new BespokeServer(webhookPort, serverPort);
        bespokeServer.start();
    });

program.parse(process.argv);
开发者ID:debmalya,项目名称:bst,代码行数:20,代码来源:bst-server.ts


示例4: config

import { config } from 'dotenv';
import fetch from 'node-fetch';
import FormData from 'form-data';
import program from 'commander';
import readline from 'readline';

import { core } from 'botframework-webchat';
import { DirectLine } from './directLine';

const { createStore, postActivity, startConnection } = core;

config();

const CRLF = '\r\n';

program
  .version('1.0.0');

function main() {
  const rl = readline.createInterface({
    input: process.stdin,
    output: process.stdout
  });

  rl.setPrompt('> ');
  rl.pause();

  const store = createStore(
    store => next => action => {
      const { payload, type } = action;

      if (type === 'DIRECT_LINE/RECEIVE_ACTIVITY') {
开发者ID:billba,项目名称:botchat,代码行数:32,代码来源:index.ts


示例5: require

var chalk = require('chalk');
var packageJson = require('../package.json');
import * as moment from 'moment';
import Promise = require('bluebird');

import {
    GHRepository,
    IssueType,
    IssueState,
    IssueActivity,
    IssueActivityFilter,
    FilterCollection
    } from 'gh-issues-api';


commander.version(packageJson.version)
         .usage('[options] <OWNER> <REPOSITORY>')
         .option('-u, --user [user]', 'Github username (used to authenticate the request and raise API calls rate limits)')
         .option('-p, --password [password/token]', 'Github password or security token (used to authenticate the request and raise API calls rate limits)')
         .option('-d, --days [days]', 'Days since the last time the issue was updated (7 by default)')
         .parse(process.argv);

if (commander.args.length < 2) {
    commander.help();
    process.exit(-1);
}

var owner = commander.args[0];
var repository = commander.args[1];
var user = commander.user;
var token = commander.password;
开发者ID:pierreca,项目名称:dashboards,代码行数:31,代码来源:stale_issues.ts


示例6: CliImport

export default function CliImport() {
    let err;
    let program = require('commander');
    let colors = require('colors');
    let pkg = require('../package.json');
    let util = require('util');

    program.version(pkg.version)
        .option('-c, --collection <collection>', 'The Power BI workspace collection')
        .option('-w, --workspace <workspaceId>', 'The Power BI workspace')
        .option('-k, --accessKey <accessKey>', 'The Power BI workspace collection access key')
        .option('-n, --displayName <displayName>', 'The dataset display name')
        .option('-f, --file <file>', 'The PBIX file to upload')
        .option('-o, --overwrite [overwrite]', 'Whether to overwrite a dataset with the same name.  Default is false')
        .option('-b --baseUri [baseUri]', 'The base uri to connect to');

    program.on('--help', function () {
        console.log('  Examples:');
        console.log('');
        console.log('    $ powerbi import -c <collection> -k <accessKey> -w <workspace> -f <file>');
    });

    program.parse(process.argv);
    let settings = config.merge(program);

    if (process.argv.length === 2) {
        program.help();
    } else {
        try {
            let options: powerbi.ImportFileOptions = {};
            let token = powerbi.PowerBIToken.createDevToken(settings.collection, settings.workspace);
            let credentials = new msrest.TokenCredentials(token.generate(settings.accessKey), 'AppToken');
            let client = new powerbi.PowerBIClient(credentials, settings.baseUri, null);

            if (!_.isUndefined(settings.overwrite) && settings.overwrite) {
                options.nameConflict = 'Overwrite';
            }

            options.datasetDisplayName = settings.displayName;

            if (!fs.existsSync(settings.file)) {
                throw new Error(util.format('File "%s" not found', settings.file));
            }

            cli.print('Importing %s to workspace: %s', settings.file, settings.workspace);

            client.imports.uploadFile(settings.collection, settings.workspace, settings.file, options, (err, result, request, response) => {
                if (err) {
                    return cli.error(err);
                }

                let importResult: powerbi.ImportModel = result;

                cli.print('File uploaded successfully');
                cli.print('Import ID: %s', importResult.id);

                checkImportState(client, importResult, (importStateErr, importStateResult) => {
                    if (importStateErr) {
                        return cli.print(importStateErr);
                    }

                    cli.print('Import succeeded');
                });
            });
        } catch (err) {
            cli.error(err);
        }
    }

    /**
     * Checks the import state of the requested import id
     */
    function checkImportState(client: powerbi.PowerBIClient, importResult: powerbi.ImportModel, callback) {
        client.imports.getImportById(settings.collection, settings.workspace, importResult.id, (err, result) => {
            importResult = result;
            cli.print('Checking import state: %s', importResult.importState);

            if (importResult.importState === 'Succeeded' || importResult.importState === 'Failed') {
                callback(null, importResult);
            } else {
                setTimeout(() => {
                    checkImportState(client, importResult, callback);
                }, 500);
            }
        });
    }
}
开发者ID:llenroc,项目名称:PowerBI-Cli,代码行数:87,代码来源:cli-import.ts


示例7: resolve

        } else {
            list.push(pathJoin(path, file));
        }
    });

    return list;
}

// Main -------------------------------------------------------------------

// Set the application root so that configuration files can be located
let programAppRoot = resolve(__dirname, "..");
let programDeployConfigFile = pathJoin(programAppRoot, "deploy.json");

// Configure the script
program.version("0.0.1")
       .description("Helper script to perform a deployment of the built templates")
       .option("-c, --config [config]", "Configuration file to use", programDeployConfigFile);

// Add command to upload the files to blob storage
program.command("upload <subscription>")
       .description("Upload files to blob storage. Storage account and container are taken from configuration or overridden with options")
       .option("-s, --saname [name]", "Storage account name")
       .option("-n, --container [container]", "Name of container within specified storage")
       .option("-a, --authfile [authfilename]", "Path to Azure credentials file", pathJoin(homedir(), ".azure", "credentials"))
       .option("-G, --groupname [sagroupname]", "Name of the resource group that contains the storage account")
       .action((subscription, options) => {
           upload(parseConfig(programAppRoot, program.config, options, "upload"), subscription);
       });

// Add command to manage resource group and deploy the template
开发者ID:chef-partners,项目名称:arm-chef-nodes,代码行数:31,代码来源:deploy.ts


示例8: ConvertBlackWhite

    convertBlackWhite: new ConvertBlackWhite(),
    // pixelSortBlackVert: require("./lib/pixel-sort-black-vert.js"),
    sortBrightness: new SortBrightness(),
    // pixelSortGreenChannel: require("./lib/pixel-sort-green-channel.js"),
    // pixelSortRedChannel: require("./lib/pixel-sort-red-channel.js"),
    // pixelSortBlueChannel: require("./lib/pixel-sort-blue-channel.js"),
    redBlueSwitch: new RedBlueSwitch(),
    redGreenSwitch: new RedGreenSwitch(),
    blueGreenSwitch: new BlueGreenSwitch(),
    sortBlack: new SortBlack(),
    sortBlackHi: new SortBlackHi(),
    sortBlackHoriz: new SortBlackHoriz(),
    sortWhite: new SortWhite()
};

commander
    .version("0.0.1")
    .option("-f, --file <filename>", "Path to file to sort. Will sort all png if this is a directory")
    .option("-t, --transformation <transformation...>", "Transformations to apply to image. To do multiple transformations, separate with commas")
    .option("--all", "Apply all transforms to the given file");

commander.on("--help", function() {
    console.log("  Valid Transformations:");
    console.log("");
    for (const [key, value] of Object.entries(allTransforms)) {
        console.log(`    ${key}: ${value.description()}`);
    }
});

commander.parse(process.argv);

if (!commander.file || (!commander.all && !commander.transformation)) {
开发者ID:dustinbarnes,项目名称:pixel-sorting,代码行数:32,代码来源:pixel-sorter.ts


示例9: limit

import * as program from "commander";
import * as fs from "fs";
import * as goita from "goita-core";
const packageJson = JSON.parse(fs.readFileSync(__dirname + "/../package.json").toString());

const command = program.version(packageJson.version)
    .option("-l, --limit [limit]", "search limit(leaves)", 10000)
    .parse(process.argv);

const solver = new goita.Solver();

for (const a of command.args) {
    const evalMoves = solver.solve(a);
    if (evalMoves.length > 0) {
        process.stdout.write("Solve result for:\n");
        process.stdout.write(a + "\n");
        for (const m of evalMoves) {
            const result = m.move.toOpenString() + "(" + m.move.toOpenTextString() + "), score:" + m.score + ", trailing moves: " + m.history.replace(a + ",", "");
            process.stdout.write(result + "\n");
        }
    } else {
        process.stdout.write("cannot evaluate moves\n");
    }
}

process.exit(0);
开发者ID:Goita,项目名称:goita-cli,代码行数:26,代码来源:cli-solve.ts


示例10: require

/// <reference path="typings/tsd.d.ts" />
import install = require("./index-install");
import links = require("./index-links");
import npmi = require("./index-npmi");

var program = require('commander');
var pkginfo = require('pkginfo')(module);
var path = require("path");

program
  .version(module.exports.version || "unknown")
  .command("install", "Install MyKoop from fresh")
  .command("links", "Update npm link & tsd link for local development")
  .command("npmi", "Runs npm install on all repositories")
  .parse(process.argv);
开发者ID:my-koop,项目名称:installation,代码行数:15,代码来源:index.ts



注:本文中的commander.version函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript commander.Command类代码示例发布时间:2022-05-25
下一篇:
TypeScript commander.outputHelp函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap