當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript shelljs.which函數代碼示例

本文整理匯總了TypeScript中shelljs.which函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript which函數的具體用法?TypeScript which怎麽用?TypeScript which使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了which函數的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: function

var resolveCapabilityViaShell = function(filteredEnv: any, command: string, args: string, capability: string) {
    var tool = shell.which(command);
    if (!tool) {
        return;
    }

    var val = shell.exec(command + ' ' + args, {silent:true}).output;
    if (val) {
        setCapability(filteredEnv, capability, val);
    }
}
開發者ID:ElleCox,項目名稱:vso-agent,代碼行數:11,代碼來源:environment.ts

示例2: getCredentials

export function getCredentials() {
  if (!shell.which('git')) {
    return vscode.window.showErrorMessage("Sorry, git must be installed.");
  }
  var user
  return getUser().then( u => {
    user = u;
    return getPass()
  })
  .then(p =>
      Promise.resolve({
        user: user,
        pass: p,
        sendImmediately: true
      })
    )
}
開發者ID:satokaz,項目名稱:vscode-gist,代碼行數:17,代碼來源:auth.ts

示例3: require

/// <reference path="../../../definitions/mocha.d.ts"/>
/// <reference path="../../../definitions/node.d.ts"/>
/// <reference path="../../../definitions/Q.d.ts"/>

import Q = require('q');
import psm = require('../../lib/psRunner');
import path = require('path');
var shell = require('shelljs');
var ps = shell.which('powershell');
var psr = null;

describe('SonarQubePreBuild Suite', function () {
    this.timeout(20000);

    before((done) => {
        if (ps) {
            psr = new psm.PSRunner();
            psr.start();
        }

        done();
    });

    after(function () {
        psr.kill();
    });

    if (ps) {
        it('CreateCommandLineArgs tests', (done) => {
            psr.run(path.join(__dirname, 'CreateCommandLineArgs.ps1'), done);
        })
開發者ID:Alekseypv,項目名稱:vsts-tasks,代碼行數:31,代碼來源:_suite.ts

示例4: require

/// <reference path="../../../definitions/mocha.d.ts"/>
/// <reference path="../../../definitions/node.d.ts"/>
/// <reference path="../../../definitions/Q.d.ts"/>

import Q = require('q');
import assert = require('assert');
import trm = require('../../lib/taskRunner');
import psm = require('../../lib/psRunner');
import path = require('path');
var shell = require('shelljs');
var ps = shell.which('powershell.exe');
var psr = null;

describe('VSBuild Suite', function () {
    this.timeout(20000);

    before((done) => {
        if (ps) {
            psr = new psm.PSRunner();
            psr.start();
        }

        done();
    });

    after(function () {
        psr.kill();
    });

    if (ps) {
        it('(Select-MSBuildLocation) maps vs versions', (done) => {
開發者ID:HSAR,項目名稱:vso-agent-tasks,代碼行數:31,代碼來源:_suite.ts

示例5: constructor

	constructor(location: string) {
		this.repo = location;
		this.git = shell.which('git');
	}
開發者ID:ElleCox,項目名稱:vso-agent,代碼行數:4,代碼來源:gitrepo.ts

示例6: removeItems

      ),
      pattern: /^(y(es)?|n(o)?)$/i,
      type: "string",
      required: true,
      message: 'You need to type "Yes" or "No" to continue...'
    }
  }
}

_prompt.start()
_prompt.message = ""

// Clear console
process.stdout.write('\x1B[2J\x1B[0f');

if (!which("git")) {
  console.log(colors.red("Sorry, this script requires git"))
  removeItems()
  process.exit(1)
}

// Say hi!
console.log(
  colors.cyan("Hi! You're almost ready to make the next great TypeScript library.")
)

// Generate the library name and start the tasks
if (process.env.CI == null) {
  if (!libraryNameSuggestedIsDefault()) {
    libraryNameSuggestedAccept()
  } else {
開發者ID:robertrbairdii,項目名稱:typescript-library-starter,代碼行數:31,代碼來源:init.ts

示例7: showUsage

// servicename: vsoagent.{accountName}.{agentName}
var cfg = cfgm.read();
var hostName = url.parse(cfg.serverUrl).hostname;
var accountName = hostName.split('.')[0];
var agentName = cfg.agentName;
var svcName = 'vsoagent.' + accountName + '.' + agentName;
console.log('serviceName: vsoagent.' + svcName);
var svcinstall = new si.SvcInstall();

/*
if (typeof svcinstall[action] !== 'function') {
    showUsage(1);
}*/

// node is known as nodejs on some *nix installs
var nodePath = shelljs.which('nodejs') || shelljs.which('node');
var getSvcCfg = function () {
    if (!shelljs.test('-f', _cfgPath)) {
        console.error('Error: not configured as a service.  use install action.');
        return null;
    }
    var svcCfg = JSON.parse(fs.readFileSync(_cfgPath).toString());
    return svcCfg;
};

var runAction = function (action, item): Q.Promise<void> {
    var defer = Q.defer<void>();

    console.log();
    console.log(action + ' ' + item);
    svcinstall[action](item, function (err) {
開發者ID:itsananderson,項目名稱:vso-agent,代碼行數:31,代碼來源:service.ts

示例8: getShellWhich

export function getShellWhich(moduleName: string): string {
    return shell.which(moduleName);
}
開發者ID:Microsoft,項目名稱:vsts-rm-extensions,代碼行數:3,代碼來源:ansibleUtils.ts


注:本文中的shelljs.which函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。