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
0760c8be
Commit
0760c8be
authored
Nov 18, 2015
by
Adam Barth
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #446 from abarth/improve_version
Improve flutter --version output
parents
74f08e73
835e7f25
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
6 deletions
+22
-6
flutter_command_runner.dart
...lutter_tools/lib/src/commands/flutter_command_runner.dart
+22
-6
No files found.
packages/flutter_tools/lib/src/commands/flutter_command_runner.dart
View file @
0760c8be
...
...
@@ -151,15 +151,31 @@ class FlutterCommandRunner extends CommandRunner {
if
(
globalResults
.
wasParsed
(
'package-root'
))
ArtifactStore
.
packageRoot
=
globalResults
[
'package-root'
];
if
(
globalResults
[
'version'
])
{
String
revision
=
runSync
([
'git'
,
'rev-parse'
,
'HEAD'
if
(
globalResults
[
'version'
])
return
_printVersion
();
return
super
.
runCommand
(
globalResults
);
}
Future
<
int
>
_printVersion
()
async
{
String
upstream
=
runSync
([
'git'
,
'rev-parse'
,
'--abbrev-ref'
,
'--symbolic'
,
'@{u}'
],
workingDirectory:
ArtifactStore
.
flutterRoot
).
trim
();
String
repository
=
'<unknown>'
;
int
slash
=
upstream
.
indexOf
(
'/'
);
if
(
slash
!=
-
1
)
{
String
remote
=
upstream
.
substring
(
0
,
slash
);
repository
=
runSync
([
'git'
,
'ls-remote'
,
'--get-url'
,
remote
],
workingDirectory:
ArtifactStore
.
flutterRoot
).
trim
();
print
(
'flutter version
$revision
'
);
return
new
Future
<
int
>.
value
(
0
);
upstream
=
upstream
.
substring
(
slash
+
1
);
}
String
revision
=
runSync
([
'git'
,
'log'
,
'-n'
,
'1'
,
'--pretty=format:%H (%ar)'
],
workingDirectory:
ArtifactStore
.
flutterRoot
).
trim
();
return
super
.
runCommand
(
globalResults
);
print
(
'Flutter
\n
Repository:
$repository
\n
Branch:
$upstream
\n
Revision:
$revision
'
);
return
0
;
}
String
_findEnginePath
(
ArgResults
globalResults
)
{
...
...
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