Skip to content

Commit

Permalink
cli: remove selection when we have only one option
Browse files Browse the repository at this point in the history
  • Loading branch information
VictorTrapenok authored and ovr committed Nov 12, 2020
1 parent cdb0f21 commit eb70ddc
Showing 1 changed file with 10 additions and 7 deletions.
17 changes: 10 additions & 7 deletions packages/cubejs-cli/src/config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,14 +156,17 @@ export class Config {
throw `${url} doesn't have any managed deployments. Please create one.`;
}

const { deployment } = await inquirer.prompt([{
type: 'list',
name: 'deployment',
message: 'Please select a deployment to deploy to',
choices: deployments
}]);
let deploymentId = deployments[0].id;
if (deployments.length > 1) {
const { deployment } = await inquirer.prompt([{
type: 'list',
name: 'deployment',
message: 'Please select a deployment to deploy to',
choices: deployments
}]);
deploymentId = deployments.find(d => d.name === deployment).id;
}

const deploymentId = deployments.find(d => d.name === deployment).id;
await this.writeDotCubeCloud({
url,
deploymentId
Expand Down

0 comments on commit eb70ddc

Please sign in to comment.