Skip to content

Commit

Permalink
refactor: Add select all projects option (#66)
Browse files Browse the repository at this point in the history
* refactor: Remove token generate usage

* fix: Make token value nullable for listTokens

* feat: add All projects select option
  • Loading branch information
HereEast authored Mar 26, 2024
1 parent 1d7274d commit c2e786f
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion packages/globe_cli/lib/src/utils/prompts.dart
Original file line number Diff line number Diff line change
Expand Up @@ -360,12 +360,20 @@ Future<List<Project>> selectProjects(
final projectsBySlug = projects
.fold<Map<String, Project>>({}, (prev, curr) => prev..[curr.slug] = curr);

final projectChoices = projectsBySlug.keys.toList();
projectChoices.insert(0, 'All projects');

/// Ask user to choose zero or more options.
final selections = logger.chooseAny(
'❓ $question',
choices: projectsBySlug.keys.toList(),
choices: projectChoices,
);

if (selections.contains('All projects')) {
logger.detail('All projects selected.');
return projects;
}

if (selections.isEmpty) {
logger.detail(
'No projects selected, you need to select atleast one project.',
Expand Down

0 comments on commit c2e786f

Please sign in to comment.