本文整理汇总了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);
}
}
示例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
})
)
}
示例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);
})
示例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) => {
示例5: constructor
constructor(location: string) {
this.repo = location;
this.git = shell.which('git');
}
示例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 {
示例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) {
示例8: getShellWhich
export function getShellWhich(moduleName: string): string {
return shell.which(moduleName);
}