本文整理汇总了TypeScript中execa.shell函数的典型用法代码示例。如果您正苦于以下问题:TypeScript shell函数的具体用法?TypeScript shell怎么用?TypeScript shell使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了shell函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: main
async function main() {
for (const zoom of range(minzoom, maxzoom + 1)) {
const mbtilesZoom = `${name}-z${zoom}.mbtiles`
const args = [
'--output=' + mbtilesZoom,
'--force',
'--minimum-zoom=' + zoom,
'--maximum-zoom=' + zoom,
'--full-detail=' + (16 - zoom + 16),
'--no-line-simplification',
'--no-feature-limit',
'--no-tile-size-limit',
'--no-polygon-splitting',
'--no-clipping',
'--no-duplication',
name + ext
]
if (verbose) { console.log('Args', args) }
if (verbose) { console.log('Starting zoom', zoom) }
await execa('tippecanoe', args)
if (verbose) { console.log('Finished zoom', zoom) }
await execa.shell(`sqlite3 ${mbtilesZoom} .dump >> ${name}.dump`)
if (verbose) { console.log('Dumped', mbtilesZoom) }
await execa.shell(`rm ${mbtilesZoom}`)
if (verbose) { console.log('Removed', mbtilesZoom) }
}
// Clean
await execa.shell(`sqlite3 ${name}.mbtiles < ${name}.dump`)
if (verbose) { console.log('Merge dump') }
await execa.shell(`rm -f ${name}.dump`)
if (verbose) { console.log('Removed dump') }
console.log('All Done! :)')
}
开发者ID:osmottawa,项目名称:imports,代码行数:33,代码来源:create-mbtiles.ts
示例2: async
async () => {
const { stdout } = await execa.shell('noop foo', {
shell: process.platform === 'win32' ? 'cmd.exe' : '/bin/bash'
});
assert(stdout === 'foo');
};
开发者ID:DanCorder,项目名称:DefinitelyTyped,代码行数:7,代码来源:execa-tests.ts
示例3: getVersionString
export function getVersionString(path: string) {
const cmd = `${path} --version`
log('finding version string using command "%s"', cmd)
return execa
.shell(cmd)
.then(result => result.stdout)
.then(trim)
}
开发者ID:YOU54F,项目名称:cypress,代码行数:8,代码来源:index.ts
示例4: invoke
function invoke(cmd: string, options: IRunOptions = {}) {
const { silent = false } = options;
// Invoke the command.
const promise = execa.shell(cmd);
// Write to console.
if (!silent) {
promise.stdout.pipe(process.stdout);
}
// Finish up.
return promise;
}
开发者ID:philcockfield,项目名称:command-interface,代码行数:14,代码来源:util.exec.ts
示例5: resolve
return new Promise<string>(async (resolve, reject) => {
try {
const config = await gitconfig.getCombinedConfig()
const { gtPrivateKeyPath } = config[`remote "origin"`]
const { name, email } = config.user
const env = {
GIT_SSH_COMMAND: `ssh -i ${gtPrivateKeyPath} -oIdentitiesOnly=yes`,
GIT_COMMITTER_NAME: name,
GIT_COMMITTER_EMAIL: email,
GIT_AUTHOR_NAME: name,
GIT_AUTHOR_EMAIL: email,
}
const result = await execa.shell(command.join(' '), { env })
resolve(result.stdout)
} catch (err) {
reject(err)
}
})
开发者ID:uetchy,项目名称:git-account,代码行数:18,代码来源:index.ts
示例6: mdfind
export function mdfind(id: string): Promise<string> {
const cmd = `mdfind 'kMDItemCFBundleIdentifier=="${id}"' | head -1`
log('looking for bundle id %s using command: %s', id, cmd)
const logFound = (str: string) => {
log('found %s at %s', id, str)
return str
}
const failedToFind = () => {
log('could not find %s', id)
throw notInstalledErr(id)
}
return execa
.shell(cmd)
.then(result => result.stdout)
.then(tap(logFound))
.catch(failedToFind)
}
开发者ID:YOU54F,项目名称:cypress,代码行数:20,代码来源:util.ts
示例7: getLinuxBrowser
function getLinuxBrowser(
name: string,
binary: string,
versionRegex: RegExp
): Promise<FoundBrowser> {
const getVersion = (stdout: string) => {
const m = versionRegex.exec(stdout)
if (m) {
return m[1]
}
log(
'Could not extract version from %s using regex %s',
stdout,
versionRegex
)
return notInstalledErr(binary)
}
const returnError = (err: Error) => {
log('Could not detect browser %s', err.message)
return notInstalledErr(binary)
}
const cmd = `${binary} --version`
log('looking using command "%s"', cmd)
return execa
.shell(cmd)
.then(result => result.stdout)
.then(trim)
.then(tap(log))
.then(getVersion)
.then((version: string) => {
return {
name,
version,
path: binary
}
})
.catch(returnError)
}
开发者ID:lgandecki,项目名称:cypress,代码行数:40,代码来源:index.ts
示例8: exec
it('should execute migrations', async () => {
const command = `${cliPath} migrate --url ${utils.dbURL}`
await exec(command, {cwd: fixturesPath})
expect(await state.queryInterface.describeTable('users')).toMatchSnapshot()
expect(await state.queryInterface.describeTable('photos')).toMatchSnapshot()
const [indexes] = await state.sequelize.query('show index from users')
expect(indexes.map(index => index.Key_name)).toMatchSnapshot()
})
开发者ID:patrickhulce,项目名称:klay,代码行数:8,代码来源:cli.test.ts
示例9: it
it('should have created a migration file', async () => {
const command = `${cliPath} migration:bootstrap --kiln-file kiln.js`
const {stdout} = await exec(command, {cwd: fixturesPath})
const filename = stdout.match(/(migrations.*)/)[1].trim()
state.migrationFile = path.join(fixturesPath, filename)
const content = fs.readFileSync(state.migrationFile, 'utf8')
expect(content).toMatchSnapshot()
})
开发者ID:patrickhulce,项目名称:klay,代码行数:9,代码来源:cli.test.ts
注:本文中的execa.shell函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论