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): support custom description #158

Merged
merged 4 commits into from
Jul 27, 2021
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
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ Creates a new very good project in the specified directory.
Usage: very_good create <output directory>
-h, --help Print this usage information.
--project-name The project name for this new Flutter project. This must be a valid dart package name.
--desc The description for this new project.
--org-name The organization for this new Flutter project.
(defaults to "com.example.verygoodcore")
-t, --template The template used to generate this new project.
Expand Down
15 changes: 14 additions & 1 deletion lib/src/commands/create.dart
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,11 @@ class CreateCommand extends Command<int> {
'This must be a valid dart package name.',
defaultsTo: null,
)
..addOption(
'desc',
help: 'The description for this new project.',
defaultsTo: '',
)
..addOption(
'org-name',
help: 'The organization for this new Flutter project.',
Expand Down Expand Up @@ -91,13 +96,18 @@ class CreateCommand extends Command<int> {
Future<int> run() async {
final outputDirectory = _outputDirectory;
final projectName = _projectName;
final description = _description;
final orgName = _orgName;
final template = _template;
final generateDone = _logger.progress('Bootstrapping');
final generator = await _generator(template.bundle);
final fileCount = await generator.generate(
DirectoryGeneratorTarget(outputDirectory, _logger),
vars: {'project_name': projectName, 'org_name': orgName},
vars: {
'project_name': projectName,
'description': description,
'org_name': orgName
},
);
generateDone('Generated $fileCount file(s)');

Expand All @@ -124,6 +134,9 @@ class CreateCommand extends Command<int> {
return projectName;
}

//// Gets the description for the project
String get _description => _argResults['desc'] as String? ?? '';

/// Gets the organization name.
List<Map<String, String>> get _orgName {
final orgName = _argResults['org-name'] as String? ?? _defaultOrgName;
Expand Down
8 changes: 4 additions & 4 deletions lib/src/templates/very_good_core_bundle.dart

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading