本文整理汇总了TypeScript中commandpost.exec函数的典型用法代码示例。如果您正苦于以下问题:TypeScript exec函数的具体用法?TypeScript exec怎么用?TypeScript exec使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了exec函数的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: expand
opts: {
replace: replace,
baseDir: baseDir,
formattersDir: formattersDir,
dryRun: dryRun,
tslint: tslint,
tslintRulesDir: tslintRulesDir,
verbose: verbose,
}
})
.then(showResultHandler)
.catch(errorHandler);
});
commandpost
.exec(root, process.argv)
.catch(errorHandler);
function expand(inputFileList: string[]): string[]
{
const result: string[] = [];
const rootPath = process.cwd();
inputFileList.forEach(fileName =>
{
fileName = path.resolve(rootPath, fileName);
const fileStats = fs.statSync(fileName);
if (fileStats.isDirectory())
{
const fileList: string[] = [];
walkSync(fileName, fileList);
示例2: await
const namespace = opts.namespace[0];
const withQuery = opts.withQuery;
const sortProps = opts.sortProps;
const input = await (args.input_filename ? fromFile(args.input_filename) : fromStdin());
const model = await convert(YAML.safeLoad(input), { namespace, withQuery, sortProps });
if (outputFilename) {
fs.writeFileSync(outputFilename, model);
} else {
process.stdout.write(model);
}
process.exit(0);
});
commandpost.exec(root, process.argv).catch(errorHandler);
function fromStdin() {
process.stdin.setEncoding("utf-8");
return new Promise<string>((resolve, reject) => {
let data = "";
process.stdin
.on("data", chunk => (data += chunk))
.once("end", () => resolve(data))
.once("error", err => reject(err));
setTimeout(() => {
if (data) {
return;
}
reject();
}, 1000);