Skip to content

Commit

Permalink
fix: Boolean arguments are now be named
Browse files Browse the repository at this point in the history
  • Loading branch information
spydon committed Dec 8, 2023
1 parent 8117a51 commit b3d1c62
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 11 deletions.
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,6 @@ build/

# Directory created by dartdoc
doc/api/

# IDE specifics
.idea/
14 changes: 7 additions & 7 deletions lib/commands/create_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,17 @@ Future<void> createCommand(ArgResults command) async {
}

final name = getString(
isInteractive: interactive,
command,
interactive,
'name',
'Choose a name for your project: ',
desc: 'Note: this must be a valid dart identifier (no dashes). '
'For example: my_game',
);

final org = getString(
isInteractive: interactive,
command,
interactive,
'org',
'Choose an org for your project: ',
desc: 'Note: this is a dot separated list of "packages", '
Expand All @@ -39,8 +39,8 @@ Future<void> createCommand(ArgResults command) async {
final versions = FlameVersionManager.singleton.versions;
final flameVersions = versions[Package.flame]!;
final flameVersion = getOption(
isInteractive: interactive,
command,
interactive,
'flame-version',
'Which Flame version do you wish to use?',
flameVersions.visible.associateWith((e) => e),
Expand All @@ -53,11 +53,11 @@ Future<void> createCommand(ArgResults command) async {
.map((key) => key.name)
.toList();
final extraPackages = getMultiOption(
isInteractive: interactive,
isRequired: false,
command,
interactive,
'extra-packages',
'Which extra packages do you wish to include?',
false,
extraPackageOptions,
startingOptions: Package.preSelectedByDefault.map((e) => e.name).toList(),
);
Expand All @@ -74,8 +74,8 @@ Future<void> createCommand(ArgResults command) async {
print('\nYour current directory is: $currentDir');

final createFolder = getOption(
isInteractive: interactive,
command,
interactive,
'create-folder',
'Do you want to put your project files directly on the current dir, '
'or do you want to create a folder called $name?',
Expand All @@ -88,8 +88,8 @@ Future<void> createCommand(ArgResults command) async {

print('\n');
final template = getOption(
isInteractive: interactive,
command,
interactive,
'template',
'What template would you like to use for your new project?',
Template.templates
Expand Down
8 changes: 4 additions & 4 deletions lib/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@ String getBundledFile(String name) {

String getString(
ArgResults results,
bool isInteractive,
String name,
String message, {
required bool isInteractive,
String? desc,
}) {
var value = results[name] as String?;
Expand All @@ -39,10 +39,10 @@ String getString(

String getOption(
ArgResults results,
bool isInteractive,
String name,
String message,
Map<String, String> options, {
required bool isInteractive,
String? desc,
String? defaultsTo,
Map<String, String> fullOptions = const {},
Expand Down Expand Up @@ -77,11 +77,11 @@ String getOption(

List<String> getMultiOption(
ArgResults results,
bool isInteractive,
String name,
String message,
bool required,
List<String> options, {
required bool isInteractive,
required bool isRequired,
List<String> startingOptions = const [],
String? desc,
}) {
Expand Down

0 comments on commit b3d1c62

Please sign in to comment.