File tree Expand file tree Collapse file tree 2 files changed +4
-1
lines changed
Expand file tree Collapse file tree 2 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,7 @@ Future<void> createCommand(ArgResults command) async {
2424 'Choose a name for your project: ' ,
2525 desc: 'Note: this must be a valid dart identifier (no dashes). '
2626 'For example: my_game' ,
27+ validate: (it) => ! it.contains ('-' ) && it != 'test' ,
2728 );
2829
2930 final org = getString (
@@ -34,6 +35,7 @@ Future<void> createCommand(ArgResults command) async {
3435 desc: 'Note: this is a dot separated list of "packages", '
3536 'normally in reverse domain notation. '
3637 'For example: org.flame_engine.games' ,
38+ validate: (it) => ! it.contains ('-' ),
3739 );
3840
3941 final versions = FlameVersionManager .singleton.versions;
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ String getString(
1717 String message, {
1818 required bool isInteractive,
1919 String ? desc,
20+ bool Function (String )? validate,
2021}) {
2122 var value = results[name] as String ? ;
2223 if (! isInteractive) {
@@ -29,7 +30,7 @@ String getString(
2930 if (desc != null ) {
3031 stdout.write (ansi.darkGray.wrap ('\n $desc \u {1B}[1A\r ' ));
3132 }
32- value = prompts.get (message, validate: (it) => ! it. contains ( '-' ) );
33+ value = prompts.get (message, validate: validate );
3334 if (desc != null ) {
3435 stdout.write ('\r\u {1B}[K' );
3536 }
You can’t perform that action at this time.
0 commit comments