Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(create_command): add --org alias #246

Merged
merged 1 commit into from
Jan 5, 2022
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
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