Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions lib/commands/create_command.dart
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Future<void> createCommand(ArgResults command) async {
'Choose a name for your project: ',
desc: 'Note: this must be a valid dart identifier (no dashes). '
'For example: my_game',
validate: (it) => !it.contains('-') && it != 'test',
);

final org = getString(
Expand All @@ -34,6 +35,7 @@ Future<void> createCommand(ArgResults command) async {
desc: 'Note: this is a dot separated list of "packages", '
'normally in reverse domain notation. '
'For example: org.flame_engine.games',
validate: (it) => !it.contains('-'),
);

final versions = FlameVersionManager.singleton.versions;
Expand Down
3 changes: 2 additions & 1 deletion lib/utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ String getString(
String message, {
required bool isInteractive,
String? desc,
bool Function(String)? validate,
}) {
var value = results[name] as String?;
if (!isInteractive) {
Expand All @@ -29,7 +30,7 @@ String getString(
if (desc != null) {
stdout.write(ansi.darkGray.wrap('\n$desc\u{1B}[1A\r'));
}
value = prompts.get(message, validate: (it) => !it.contains('-'));
value = prompts.get(message, validate: validate);
if (desc != null) {
stdout.write('\r\u{1B}[K');
}
Expand Down