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
949e27ae
Commit
949e27ae
authored
Oct 26, 2016
by
Dan Rubel
Committed by
GitHub
Oct 26, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
improve flutter create error message (#6525)
parent
80627a5c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
25 additions
and
3 deletions
+25
-3
create.dart
packages/flutter_tools/lib/src/commands/create.dart
+9
-3
create_test.dart
packages/flutter_tools/test/create_test.dart
+16
-0
No files found.
packages/flutter_tools/lib/src/commands/create.dart
View file @
949e27ae
...
...
@@ -47,13 +47,19 @@ class CreateCommand extends FlutterCommand {
@override
Future
<
int
>
runCommand
()
async
{
if
(
argResults
.
rest
.
isEmpty
)
{
print
Status
(
'No option specified for the output directory.'
);
print
Status
(
usage
);
print
Error
(
'No option specified for the output directory.'
);
print
Error
(
usage
);
return
2
;
}
if
(
argResults
.
rest
.
length
>
1
)
{
printStatus
(
'Multiple output directories specified.'
);
printError
(
'Multiple output directories specified.'
);
for
(
String
arg
in
argResults
.
rest
)
{
if
(
arg
.
startsWith
(
'-'
))
{
printError
(
'Try moving
$arg
to be immediately following
$name
'
);
break
;
}
}
return
2
;
}
...
...
packages/flutter_tools/test/create_test.dart
View file @
949e27ae
...
...
@@ -7,6 +7,7 @@ import 'dart:convert';
import
'dart:io'
;
import
'package:args/command_runner.dart'
;
import
'package:flutter_tools/src/base/logger.dart'
;
import
'package:flutter_tools/src/cache.dart'
;
import
'package:flutter_tools/src/commands/create.dart'
;
import
'package:flutter_tools/src/dart/sdk.dart'
;
...
...
@@ -82,6 +83,21 @@ void main() {
expect
(
code
,
0
);
});
// Verify that we help the user correct an option ordering issue
BufferLogger
logger
=
new
BufferLogger
();
testUsingContext
(
'produces sensible error message'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
CreateCommand
command
=
new
CreateCommand
();
CommandRunner
runner
=
createTestCommandRunner
(
command
);
int
code
=
await
runner
.
run
(<
String
>[
'create'
,
temp
.
path
,
'--pub'
]);
expect
(
code
,
2
);
expect
(
logger
.
errorText
,
contains
(
'Try moving --pub'
));
},
overrides:
<
Type
,
dynamic
>{
Logger:
logger
,
});
// Verify that we fail with an error code when the file exists.
testUsingContext
(
'fails when file exists'
,
()
async
{
Cache
.
flutterRoot
=
'../..'
;
...
...
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