本文整理匯總了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);
}