Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
F
Front-End
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
abdullh.alsoleman
Front-End
Commits
bde44417
Commit
bde44417
authored
Feb 18, 2016
by
Devon Carew
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #2010 from devoncarew/create_command
make the '-o' option in create optional
parents
242fce05
0da7463e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
21 additions
and
6 deletions
+21
-6
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+21
-6
No files found.
packages/flutter_tools/lib/src/commands/create.dart
View file @
bde44417
...
...
@@ -18,19 +18,27 @@ import '../ios/setup_xcodeproj.dart';
class
CreateCommand
extends
Command
{
final
String
name
=
'create'
;
final
String
description
=
'Create a new Flutter project.'
;
final
List
<
String
>
aliases
=
<
String
>[
'init'
];
CreateCommand
()
{
argParser
.
addOption
(
'out'
,
abbr:
'o'
,
help:
'The output directory.'
);
argParser
.
addOption
(
'out'
,
abbr:
'o'
,
hide:
true
,
help:
'The output directory.'
);
argParser
.
addFlag
(
'pub'
,
defaultsTo:
true
,
help:
'Whether to run "pub get" after the project has been created.'
);
defaultsTo:
true
,
help:
'Whether to run "pub get" after the project has been created.'
);
}
String
get
invocation
=>
"
${runner.executableName}
$name
<output directory>"
;
@override
Future
<
int
>
run
()
async
{
if
(!
argResults
.
wasParsed
(
'out'
))
{
if
(!
argResults
.
wasParsed
(
'out'
)
&&
argResults
.
rest
.
isEmpty
)
{
printStatus
(
'No option specified for the output directory.'
);
printStatus
(
argParser
.
usage
);
printStatus
(
usage
);
return
2
;
}
...
...
@@ -39,6 +47,7 @@ class CreateCommand extends Command {
printError
(
'variable was specified. Unable to find package:flutter.'
);
return
2
;
}
String
flutterRoot
=
path
.
absolute
(
ArtifactStore
.
flutterRoot
);
String
flutterPackagePath
=
path
.
join
(
flutterRoot
,
'packages'
,
'flutter'
);
...
...
@@ -47,7 +56,13 @@ class CreateCommand extends Command {
return
2
;
}
Directory
out
=
new
Directory
(
argResults
[
'out'
]);
Directory
out
;
if
(
argResults
.
wasParsed
(
'out'
))
{
out
=
new
Directory
(
argResults
[
'out'
]);
}
else
{
out
=
new
Directory
(
argResults
.
rest
.
first
);
}
new
FlutterSimpleTemplate
().
generateInto
(
out
,
flutterPackagePath
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment