From 5c02f19f0eac6fe43281d111fc620e3421df34c4 Mon Sep 17 00:00:00 2001 From: Felix Angelov Date: Wed, 5 Jan 2022 11:29:09 -0600 Subject: [PATCH] feat(create_command): add --org alias --- README.md | 3 +++ lib/src/commands/create.dart | 1 + test/src/commands/create_test.dart | 12 ++++++++++++ 3 files changed, 16 insertions(+) diff --git a/README.md b/README.md index 4ae2d32c..d76a9346 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,9 @@ Usage: very_good create # Create a new Flutter app named my_app very_good create my_app --desc "My new Flutter app" +# Create a new Flutter app named my_app with a custom org +very_good create my_app --desc "My new Flutter app" --org "com.custom.org" + # Create a new Flutter package named my_flutter_package very_good create my_flutter_package -t flutter_pkg --desc "My new Flutter package" diff --git a/lib/src/commands/create.dart b/lib/src/commands/create.dart index a66d2be0..715bed0a 100644 --- a/lib/src/commands/create.dart +++ b/lib/src/commands/create.dart @@ -57,6 +57,7 @@ class CreateCommand extends Command { 'org-name', help: 'The organization for this new project.', defaultsTo: _defaultOrgName, + aliases: ['org'], ) ..addOption( 'template', diff --git a/test/src/commands/create_test.dart b/test/src/commands/create_test.dart index c8a085f2..072bd419 100644 --- a/test/src/commands/create_test.dart +++ b/test/src/commands/create_test.dart @@ -289,6 +289,18 @@ void main() { }); group('org-name', () { + group('--org', () { + test('is a valid alias', () async { + const orgName = 'com.my.org'; + final tempDir = Directory.systemTemp.createTempSync(); + final result = await commandRunner.run( + ['create', p.join(tempDir.path, 'example'), '--org', orgName], + ); + expect(result, equals(ExitCode.success.code)); + tempDir.deleteSync(recursive: true); + }); + }); + group('invalid --org-name', () { Future expectInvalidOrgName(String orgName) async { final expectedErrorMessage = '"$orgName" is not a valid org name.\n\n'