How to use the cli-ux.confirm function in cli-ux

To help you get started, we’ve selected a few cli-ux examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github SakkuCloud / sakku-cli / src / commands / app / add.ts View on Github external
type: 'list',
      choices: [
        { name: 'CPU' },
        { name: 'MEM' },
        { name: 'AND' },
        { name: 'OR' },
        { name: 'OFF' }]
    })
      .then(value => value.name);

    while (await cli.confirm(messages.environment_vars)) {
      let param: string = await cli.prompt(messages.enter_your_environment_key_msg);
      environments[param] = await cli.prompt(messages.enter_your_environment_value_msg);
    }

    while (await cli.confirm(messages.labels)) {
      let param: string = await cli.prompt(messages.enter_your_label_key_msg);
      labels[param] = await cli.prompt(messages.enter_your_label_value_msg);
    }

    // while (await cli.confirm('Is there any/more links (y or n)')) {
    //   Add.link.name = await cli.prompt(enter_your_link_name_msg);
    //   Add.link.alias = await cli.prompt(enter_your_link_alias_msg);
    //   links.push(Add.link);
    // }

    while (await cli.confirm(messages.health_check)) {
      let tempObj: { endpoint: string, response: string, scheme: string } = { endpoint: '', response: '', scheme: '' };
      tempObj.endpoint = (await cli.prompt(messages.enter_your_check_point, { required: false })) || '/ping'
      tempObj.response = await cli.prompt(messages.enter_your_response, { required: true });
      tempObj.scheme = (await cli.prompt(messages.enter_your_scheme, { required: false })) || 'http';
      healthChecks.push(tempObj);
github SakkuCloud / sakku-cli / src / commands / app / add.ts View on Github external
}

      // #2: username
      git.username = await cli.prompt(messages.enter_your_git_username_msg, { required: true });

      // #3: accessToken
      git.accessToken = await cli.prompt(messages.enter_your_git_access_token_msg, { required: true });

      // #4: docker_file
      git.docker_file = (await cli.prompt(messages.enter_docker_file_address, { required: false })) || git.docker_file;

      // #5: branch
      git.urlBranch = (await cli.prompt(messages.enter_branch_name, { required: false })) || git.urlBranch;

      // #5: tags
      while (await cli.confirm(messages.more_tag)) {
        let inpTag: string = await cli.prompt(messages.enter_tag);
        git.tags.push(inpTag);
      }

      // #5: buildTags
      while (await cli.confirm(messages.more_build_args)) {
        let inpArg: string = await cli.prompt(messages.enter_build_arg);
        git.buildArgs.push(inpArg);
      }

      sendObj = {
        args,
        cmd,
        cpu,
        deployType,
        disk,
github SakkuCloud / sakku-cli / src / commands / app / add.ts View on Github external
let param: string = await cli.prompt(messages.enter_your_environment_key_msg);
      environments[param] = await cli.prompt(messages.enter_your_environment_value_msg);
    }

    while (await cli.confirm(messages.labels)) {
      let param: string = await cli.prompt(messages.enter_your_label_key_msg);
      labels[param] = await cli.prompt(messages.enter_your_label_value_msg);
    }

    // while (await cli.confirm('Is there any/more links (y or n)')) {
    //   Add.link.name = await cli.prompt(enter_your_link_name_msg);
    //   Add.link.alias = await cli.prompt(enter_your_link_alias_msg);
    //   links.push(Add.link);
    // }

    while (await cli.confirm(messages.health_check)) {
      let tempObj: { endpoint: string, response: string, scheme: string } = { endpoint: '', response: '', scheme: '' };
      tempObj.endpoint = (await cli.prompt(messages.enter_your_check_point, { required: false })) || '/ping'
      tempObj.response = await cli.prompt(messages.enter_your_response, { required: true });
      tempObj.scheme = (await cli.prompt(messages.enter_your_scheme, { required: false })) || 'http';
      healthChecks.push(tempObj);
    }

    deployType = await inquirer.prompt<{ name: string }>({
      name: 'name',
      message: 'choose your deploy type:',
      type: 'list',
      choices: [
        { name: 'DOCKER_IMAGE' },
        { name: 'CODE' }
        // {name: 'APP'},
        // {name: 'DOCKER_FILE'}
github SakkuCloud / sakku-cli / src / commands / app / rm.ts View on Github external
async run() {
    const {flags} = this.parse(RM);
    let appId = await cli.prompt('Enter your app id', {required: true});
    if (flags.force) {
      await cli.action.start('please wait...');
      await cli.wait(2000);
      cli.action.stop('removed!');
      this.log('your app is not any more exist in this universe!');
    } else {
      let confimation = await cli.confirm('are you really sure to remove? (y/n)');
      if (confimation) {
        await cli.action.start('please wait...');
        await cli.wait(2000);
        cli.action.stop('removed!');
        this.log('your app is not any more exist in this universe!');
      } else {
        this.log('notting happend!');
      }
    }
  }
}
github taneliheikkinen / heroku-wp-environment-sync / src / lib / Apps / RemoteApp.ts View on Github external
async handleMultipleEnvs () {
        ux.warn(`There is multiple db env variables defined (${this.constructEnvList(this.db_envs)}), which one is it?`)

        while(!this.db_env_name.length) {
            const db_env_name = await ux.prompt(`The db env variable name`) as string

            if(!this.hasAppEnv(db_env_name)) {
                ux.warn(`That env variable name (${Colors.env(db_env_name)}) doesn't exist in app (${Colors.app(this.name)})`);

                if(!(await ux.confirm("Want to to try again?"))) {
                    ux.error(`Ok, cannot resolve the db env variable name, so quitting.`)
                }
            } else {
                this.db_env_name = db_env_name
            }
        }

        return true
    }
github taneliheikkinen / heroku-wp-environment-sync / src / lib / CacheHandler.ts View on Github external
async cacheFolderInit () {
        if(!fs.existsSync(await this.getCacheFolder())) {
            ux.warn(`Sync cache folder doesn't exist.`)

            const create_folder = await ux.confirm(`Wan't to create it?`)
        
            if(create_folder) {
                ux.action.start(`Creating folder to ${await this.getCacheFolder()}`)

                fs.mkdirSync(await this.getCacheFolder(), {
                    recursive : true
                })

                ux.action.stop()
                ux.log()
            }
        }
    }
}
github heroku / cli / packages / pipelines / src / setup / get-settings.ts View on Github external
enabled: true,
      auto_deploy: true,
      auto_destroy: true,
    },
  }

  settings.auto_deploy = await cli.confirm(`Automatically deploy the ${branch} branch to staging?`)

  if (settings.auto_deploy) {
    settings.wait_for_ci = await cli.confirm(`Wait for CI to pass before deploying the ${branch} branch to staging?`)
  }

  settings.pull_requests.enabled = await cli.confirm('Enable review apps?')

  if (settings.pull_requests.enabled) {
    settings.pull_requests.auto_deploy = await cli.confirm('Automatically create review apps for every PR?')
  }

  if (settings.pull_requests.enabled) {
    settings.pull_requests.auto_destroy = await cli.confirm('Automatically destroy idle review apps after 5 days?')
  }

  return settings
}
github heroku / cli / packages / pipelines / src / setup / get-settings.ts View on Github external
}

  const settings = {
    auto_deploy: true,
    wait_for_ci: true,
    pull_requests: {
      enabled: true,
      auto_deploy: true,
      auto_destroy: true,
    },
  }

  settings.auto_deploy = await cli.confirm(`Automatically deploy the ${branch} branch to staging?`)

  if (settings.auto_deploy) {
    settings.wait_for_ci = await cli.confirm(`Wait for CI to pass before deploying the ${branch} branch to staging?`)
  }

  settings.pull_requests.enabled = await cli.confirm('Enable review apps?')

  if (settings.pull_requests.enabled) {
    settings.pull_requests.auto_deploy = await cli.confirm('Automatically create review apps for every PR?')
  }

  if (settings.pull_requests.enabled) {
    settings.pull_requests.auto_destroy = await cli.confirm('Automatically destroy idle review apps after 5 days?')
  }

  return settings
}
github feinoujc / gh-search-cli / src / hooks / init / auth-questions.ts View on Github external
	ghe: () => cli.confirm('Do you have a github enterprise instance?'),
	apiUrl: () =>