Skip to content

Commit

Permalink
fix(cli): filter targets without id from run device list (#4397)
Browse files Browse the repository at this point in the history
  • Loading branch information
jcesarmobile committed Apr 5, 2021
1 parent 77ef7a0 commit 9ec444f
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions cli/src/common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -390,18 +390,18 @@ export async function promptForPlatformTarget(
selectedTarget?: string,
): Promise<PlatformTarget> {
const { prompt } = await import('prompts');

const validTargets = targets.filter(t => t.id !== undefined);
if (!selectedTarget) {
if (targets.length === 1) {
return targets[0];
if (validTargets.length === 1) {
return validTargets[0];
} else {
const answers = await prompt(
[
{
type: 'select',
name: 'target',
message: 'Please choose a target device:',
choices: targets.map(t => ({
choices: validTargets.map(t => ({
title: `${getPlatformTargetName(t)} (${t.id})`,
value: t,
})),
Expand Down

0 comments on commit 9ec444f

Please sign in to comment.