Skip to content

Commit

Permalink
feat(create_command): add --org alias (#246)
Browse files Browse the repository at this point in the history
  • Loading branch information
felangel committed Jan 5, 2022
1 parent 8db1fc4 commit 3afb420
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ Usage: very_good create <output directory>
# 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"

Expand Down
1 change: 1 addition & 0 deletions lib/src/commands/create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ class CreateCommand extends Command<int> {
'org-name',
help: 'The organization for this new project.',
defaultsTo: _defaultOrgName,
aliases: ['org'],
)
..addOption(
'template',
Expand Down
12 changes: 12 additions & 0 deletions test/src/commands/create_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -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<void> expectInvalidOrgName(String orgName) async {
final expectedErrorMessage = '"$orgName" is not a valid org name.\n\n'
Expand Down

0 comments on commit 3afb420

Please sign in to comment.