• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript execa.shellSync函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中execa.shellSync函数的典型用法代码示例。如果您正苦于以下问题:TypeScript shellSync函数的具体用法?TypeScript shellSync怎么用?TypeScript shellSync使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了shellSync函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: test

 test('- Stream input', t => {
   const filename = join(tmpdir(), Math.floor(Math.random() * 10000000).toString(16) + '.txt');
   writeFileSync(filename, '你好,世界!');
   const { stdout } = execa.shellSync(`${execPath} -S < ${filename}`, { ...cmdOptions });
   unlinkSync(filename);
   t.equal(stdout, "Ni Hao, Shi Jie!");
   t.end();
 });
开发者ID:andyhu,项目名称:node-transliteration,代码行数:8,代码来源:transliterate.ts


示例2: init

 public async init(cmd: any): Promise<void> {
   const title = await this.projectName();
   const status = await this.typeScript();
   if (status) {
     const typescript = this.asTypescript();
     const command = `create-react-app ${title} ${typescript}`;
     this.logger.warn(`Creating Project ${title} as Typescript`);
     await shellSync(command);
   } else {
     const command = `create-react-app ${title}`;
     this.logger.warn(`Creating Project ${title}`);
     await shellSync(command);
   }
   this.logger.success(`${title} created successfully.`);
   this.logger.success(`Type cd ${title} into the console to visit the Project`);
   // this.logger.alegri('Do you want to add the Redux Boilerplate? y/n');
 }
开发者ID:toxictrash,项目名称:AlegriCLI,代码行数:17,代码来源:react.ts


示例3: init

 public async init(cmd: any): Promise<void> {
     const title = await this.projectName();
     const command = `ng new ${title}`;
     this.logger.warn(`Creating Project ${title}`);
     await shellSync(command);
     this.logger.success(`${title} created successfully.`);
     this.logger.success(`Type cd ${title} into the console to visit the Project`);
     // this.logger.alegri('Do you want to add the Redux Boilerplate? y/n');
 }
开发者ID:toxictrash,项目名称:AlegriCLI,代码行数:9,代码来源:angular.ts


示例4: init

 public async init(): Promise<void> {
   this.logger.log('Installing VueJS from NPM');
   await shellSync('npm install @vue/cli -g');
   this.logger.success('VueJS Install complete');
   await delay(2500);
   this.logger.log('Checking VueJS Version now');
   this.getVersion().then((version: ExecaReturns) => {
     this.logger.success(version.stdout);
   });
 }
开发者ID:toxictrash,项目名称:AlegriCLI,代码行数:10,代码来源:vue.ts


示例5: escape

const tr = (str: string, options: OptionsTransliterate = {}): string => {
  str = escape(str);
  let args = '';
  if (Array.isArray(options.ignore)) {
    args += options.ignore.map((s: string): string => ` -i "${escape(s)}"`).join('');
  }
  if (Array.isArray(options.replace)) {
    args += options.replace.map((s: [string | RegExp, string]): string => ` -r "${escape(s[0] as string)}=${escape(s[1])}"`).join('');
  }
  const [trailingSpaces] = str.match(/[\r\n]+$/) || [''];
  const { stdout } = execa.shellSync(`${execPath} "${str}"${args}`, cmdOptions);
  return stdout.replace(/[\r\n]+$/, '') + trailingSpaces;
}
开发者ID:andyhu,项目名称:node-transliteration,代码行数:13,代码来源:transliterate.ts


示例6: escape

const slugify = (str: string, options: OptionsSlugify = {}): string => {
  str = escape(str);
  let args = '';
  if (Array.isArray(options.ignore)) {
    args += options.ignore.map((s: string): string => ` -i "${escape(s)}"`).join('');
  }
  if (Array.isArray(options.replace)) {
    args += options.replace.map((s: [string | RegExp, string]): string => ` -r "${escape(s[0] as string)}=${escape(s[1])}"`).join('');
  }
  if (options.lowercase) {
    args += ' -l';
  }
  if (options.uppercase) {
    args += ' -u';
  }
  if (options.separator) {
    args += ` -s "${escape(options.separator)}"`;
  }
  const [trailingSpaces] = str.match(/[\r\n]+$/) || [''];
  const { stdout } = execa.shellSync(`${execPath} "${str}"${args}`, cmdOptions);
  return stdout + trailingSpaces;
}
开发者ID:andyhu,项目名称:node-transliteration,代码行数:22,代码来源:slugify.ts


示例7:

const exec = args => () => execa.shellSync(args.trim()).stdout
开发者ID:borestad,项目名称:playground,代码行数:1,代码来源:index.ts


示例8: execa

execa.stdout('unicorns')
    .then(stdout => stdout.toLocaleLowerCase());
execa.stdout('echo', ['unicorns'])
    .then(stdout => stdout.toLocaleLowerCase());

execa.stderr('unicorns')
    .then(stderr => stderr.toLocaleLowerCase());
execa.stderr('echo', ['unicorns'])
    .then(stderr => stderr.toLocaleLowerCase());

execa.shell('echo unicorns')
    .then(result => result.stdout.toLocaleLowerCase());

{
    let result: string;
    result = execa.shellSync('foo').stderr;
    result = execa.shellSync('noop', ['foo']).stdout;

    result = execa.shellSync('foo').stderr;
    result = execa.shellSync('noop foo').stdout;
}

execa('echo', ['unicorns']).stdout.pipe(process.stdout);
execa('echo', ['unicorns']).stderr.pipe(process.stderr);

async () => {
    const { stdout } = await execa('noop', ['foo'], { stripEof: false });
    assert(stdout === 'foo\n');
};

async () => {
开发者ID:DanCorder,项目名称:DefinitelyTyped,代码行数:31,代码来源:execa-tests.ts



注:本文中的execa.shellSync函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript execa.stdout函数代码示例发布时间:2022-05-25
下一篇:
TypeScript execa.shell函数代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap