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

TypeScript cli-framework.contains函数代码示例

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

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



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

示例1: preRun

  async preRun(inputs: CommandLineInputs, options: CommandLineOptions, runinfo: CommandInstanceInfo): Promise<void> {
    await this.preRunChecks(runinfo);

    if (options['r'] || options['noresources']) {
      options['resources'] = false;
    }

    inputs[0] = !inputs[0] ? 'ls' : inputs[0];
    inputs[0] = (inputs[0] === 'rm') ? 'remove' : inputs[0];
    inputs[0] = (inputs[0] === 'list') ? 'ls' : inputs[0];

    validate(inputs[0], 'action', [contains(['add', 'remove', 'update', 'ls', 'check', 'save'], {})]);

    // If the action is list, check, or save, then just end here.
    if (['ls', 'check', 'save'].includes(inputs[0])) {
      await this.runCordova(['platform', inputs[0]], {});
      throw new FatalException('', 0);
    }

    if (!inputs[1]) {
      const platform = await this.env.prompt({
        type: 'input',
        name: 'platform',
        message: `What platform would you like to ${inputs[0]} (${['android', 'ios'].map(v => input(v)).join(', ')}):`,
      });

      inputs[1] = platform.trim();
    }

    validate(inputs[1], 'platform', [validators.required]);
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:31,代码来源:platform.ts


示例2: preRun

  async preRun(inputs: CommandLineInputs, options: CommandLineOptions, runinfo: CommandInstanceInfo): Promise<void> {
    await this.preRunChecks(runinfo);

    inputs[0] = !inputs[0] ? 'ls' : inputs[0];
    inputs[0] = (inputs[0] === 'rm') ? 'remove' : inputs[0];
    inputs[0] = (inputs[0] === 'list') ? 'ls' : inputs[0];

    validate(inputs[0], 'action', [contains(['add', 'remove', 'ls', 'save'], {})]);

    // If the action is list then lets just end here.
    if (['ls', 'save'].includes(inputs[0])) {
      await this.runCordova(['plugin', inputs[0]], {});
      throw new FatalException('', 0);
    }

    if (!inputs[1]) {
      const plugin = await this.env.prompt({
        message: `What plugin would you like to ${inputs[0]}:`,
        type: 'input',
        name: 'plugin',
      });

      inputs[1] = plugin;
    }

    validate(inputs[1], 'plugin', [validators.required]);
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:27,代码来源:plugin.ts


示例3: run

  async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
    const { formatAilmentMessage } = await import('../../lib/doctor');

    const [ id ] = inputs;

    if (id) {
      const registry = await this.getRegistry();
      const ailmentIds = registry.ailments.map(a => a.id);
      validate(id, 'id', [contains(ailmentIds, {})]);
      const ailment = registry.get(id);

      if (!ailment) {
        throw new FatalException(`Issue not found by ID: ${input(id)}`);
      }

      const detected = await ailment.detected();

      if (!detected) {
        this.env.log.ok(`${input(ailment.id)} does not need fixing as it was not detected.`);
        return;
      }

      if (!isTreatableAilment(ailment)) {
        this.env.log.warn(await formatAilmentMessage(ailment));

        throw new FatalException(
          `Issue cannot be fixed automatically: ${input(ailment.id)}\n` +
          `Unfortunately the CLI can't automatically fix the specified issue at this time. However, please see the steps above for manually fixing the issue.`
        );
      }

      if (this.env.config.get(`doctor.issues.${ailment.id}.ignored` as any)) {
        const confirm = await this.env.prompt({
          type: 'confirm',
          name: 'confirm',
          message: `${input(ailment.id)} is ignored, are you sure you want to continue?`,
        });

        if (!confirm) {
          return;
        }

        this.env.config.unset(`doctor.issues.${ailment.id}.ignored` as any);
      }

      try {
        await this.treatAilment(ailment);
      } catch (e) {
        this.handleError(e);
      }
    } else {
      const ailments = await this.detectTreatableAilments();
      await this.treatAilments(ailments);
    }
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:55,代码来源:treat.ts


示例4: preRun

  async preRun(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
    await this.checkForOpenSSH();

    this.env.session.getUserToken();

    if (!options['annotation']) {
      options['annotation'] = this.env.config.get('user.email');
    }

    validate(String(options['type']), 'type', [contains(SSH_KEY_TYPES, { caseSensitive: false })]);
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:11,代码来源:generate.ts


示例5: getCommandMetadata

  async getCommandMetadata(): Promise<Partial<CommandMetadata>> {
    return {
      groups: [],
      summary: `Generate pipes, components, pages, directives, providers, and tabs`,
      description: `
Automatically create components for your Ionic app.

The given ${input('name')} is normalized into an appropriate naming convention. For example, ${input('ionic generate page neat')} creates a page by the name of ${input('NeatPage')} in ${input('src/pages/neat/')}.
      `,
      exampleCommands: [
        '',
        ...GENERATOR_TYPES,
        'component foo',
        'page Login',
        'page Detail --no-module',
        'page About --constants',
        'pipe MyFilterPipe',
      ],
      inputs: [
        {
          name: 'type',
          summary: `The type of generator (e.g. ${GENERATOR_TYPES.map(t => input(t)).join(', ')})`,
          validators: [validators.required, contains(GENERATOR_TYPES, {})],
        },
        {
          name: 'name',
          summary: 'The name of the component being generated',
          validators: [validators.required],
        },
      ],
      options: [
        {
          name: 'module',
          summary: 'Do not generate an NgModule for the component',
          type: Boolean,
          default: true,
        },
        {
          name: 'constants',
          summary: 'Generate a page constant file for lazy-loaded pages',
          type: Boolean,
          default: false,
        },
      ],
    };
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:46,代码来源:generate.ts


示例6: getMetadata

  async getMetadata(): Promise<CommandMetadata> {
    return {
      name: 'disable',
      type: 'project',
      summary: 'Disable an integration',
      description: `
Integrations, such as Cordova, can be disabled with this command.
      `,
      inputs: [
        {
          name: 'name',
          summary: `The integration to disable (e.g. ${INTEGRATION_NAMES.map(i => input(i)).join(', ')})`,
          validators: [validators.required, contains(INTEGRATION_NAMES, {})],
        },
      ],
    };
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:17,代码来源:disable.ts


示例7: run

  async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
    const [ id ] = inputs;

    if (id) {
      const registry = await this.getRegistry();
      const ailmentIds = registry.ailments.map(a => a.id);
      validate(id, 'id', [contains(ailmentIds, {})]);
      const ailment = registry.get(id);

      if (!ailment) {
        throw new FatalException(`Issue not found by ID: ${input(id)}`);
      }

      await this.checkAilment(ailment);
    } else {
      const ailments = await this.detectAilments();
      await this.checkAilments(ailments);
    }
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:19,代码来源:check.ts


示例8: getMetadata

  async getMetadata(): Promise<CommandMetadata> {
    return {
      name: 'enable',
      type: 'project',
      summary: 'Add & enable integrations to your app',
      description: `
Integrations, such as Cordova, can be enabled with this command. If the integration has never been added to the project, ${input('ionic integrations enable')} will download and add the integration.

Integrations can be re-added with the ${input('--add')} option.
      `,
      inputs: [
        {
          name: 'name',
          summary: `The integration to enable (e.g. ${INTEGRATION_NAMES.map(i => input(i)).join(', ')})`,
          validators: [validators.required, contains(INTEGRATION_NAMES, {})],
        },
      ],
      options: [
        {
          name: 'add',
          summary: 'Download and add the integration even if enabled',
          type: Boolean,
        },
        {
          name: 'root',
          summary: 'Specify an alternative destination to download into when adding',
          spec: { value: 'path' },
        },
        {
          name: 'quiet',
          summary: 'Do not log file operations',
          type: Boolean,
        },
      ],
    };
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:36,代码来源:enable.ts


示例9: getMetadata

  async getMetadata(): Promise<CommandMetadata> {
    const dashUrl = this.env.config.getDashUrl();

    return {
      name: 'build',
      type: 'project',
      summary: 'Create a package build on Appflow',
      description: `
This command creates a package build on Ionic Appflow. While the build is running, it prints the remote build log to the terminal. If the build is successful, it downloads the created app package file in the current directory.

Apart from ${input('--commit')}, every option can be specified using the full name setup within the Dashboard[^dashboard].

The ${input('--security-profile')} option is mandatory for any iOS build but not for Android debug builds.

Customizing the build:
- The ${input('--environment')} and ${input('--native-config')} options can be used to customize the groups of values exposed to the build.
- Override the preferred platform with ${input('--target-platform')}. This is useful for building older iOS apps.
`,
      footnotes: [
        {
          id: 'dashboard',
          url: dashUrl,
        },
      ],
      exampleCommands: [
        'android debug',
        'ios development --security-profile="iOS Security Profile Name"',
        'android debug --environment="My Custom Environment Name"',
        'android debug --native-config="My Custom Native Config Name"',
        'android debug --commit=2345cd3305a1cf94de34e93b73a932f25baac77c',
        'ios development --security-profile="iOS Security Profile Name" --target-platform="iOS - Xcode 9"',
        'ios development --security-profile="iOS Security Profile Name" --build-file-name=my_custom_file_name.ipa',
      ],
      inputs: [
        {
          name: 'platform',
          summary: `The platform to package (${PLATFORMS.map(v => input(v)).join(', ')})`,
          validators: [validators.required, contains(PLATFORMS, {})],
        },
        {
          name: 'type',
          summary: `The build type (${BUILD_TYPES.map(v => input(v)).join(', ')})`,
          validators: [validators.required, contains(BUILD_TYPES, {})],
        },
      ],
      options: [
        {
          name: 'security-profile',
          summary: 'Security profile',
          type: String,
          spec: { value: 'name' },
        },
        {
          name: 'environment',
          summary: 'The group of environment variables exposed to your build',
          type: String,
          spec: { value: 'name' },
        },
        {
          name: 'native-config',
          summary: 'The group of native config variables exposed to your build',
          type: String,
          spec: { value: 'name' },
        },
        {
          name: 'commit',
          summary: 'Commit (defaults to HEAD)',
          type: String,
          groups: [MetadataGroup.ADVANCED],
          spec: { value: 'sha1' },
        },
        {
          name: 'target-platform',
          summary: `Target platform (${TARGET_PLATFORM.map(v => input(`"${v}"`)).join(', ')})`,
          type: String,
          groups: [MetadataGroup.ADVANCED],
          spec: { value: 'name' },
        },
        {
          name: 'build-file-name',
          summary: 'The name for the downloaded build file',
          type: String,
          groups: [MetadataGroup.ADVANCED],
          spec: { value: 'name' },
        },
      ],
    };
  }
开发者ID:driftyco,项目名称:ionic-cli,代码行数:88,代码来源:build.ts


示例10: contains

 validate: v => validators.required(v) && contains(buildTypes, {})(v),
开发者ID:driftyco,项目名称:ionic-cli,代码行数:1,代码来源:build.ts



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

专题导读
上一篇:
TypeScript cli-framework.validate函数代码示例发布时间:2022-05-28
下一篇:
TypeScript angular.ToastController类代码示例发布时间:2022-05-28
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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