misc tool ui cleanup

This commit is contained in:
Devon Carew
2016-03-14 09:41:00 -07:00
parent 229253f43e
commit 4daee0cc0d
6 changed files with 37 additions and 18 deletions

View File

@@ -21,7 +21,7 @@ String _getNameForHostPlatform(HostPlatform platform) {
}
}
String _getNameForTargetPlatform(TargetPlatform platform) {
String getNameForTargetPlatform(TargetPlatform platform) {
switch (platform) {
case TargetPlatform.android_arm:
return 'android-arm';
@@ -63,7 +63,7 @@ class Artifact {
String get platform {
if (targetPlatform != null)
return _getNameForTargetPlatform(targetPlatform);
return getNameForTargetPlatform(targetPlatform);
if (hostPlatform != null)
return _getNameForHostPlatform(hostPlatform);
assert(false);

View File

@@ -29,9 +29,7 @@ class DevicesCommand extends FlutterCommand {
printStatus('No connected devices.');
} else {
printStatus('${devices.length} connected ${pluralize('device', devices.length)}:\n');
for (Device device in devices)
printStatus(device.fullDescription);
Device.printDevices(devices);
}
return 0;

View File

@@ -3,12 +3,15 @@
// found in the LICENSE file.
import 'dart:async';
import 'dart:math' as math;
import 'android/android_device.dart';
import 'application_package.dart';
import 'artifacts.dart';
import 'base/common.dart';
import 'base/utils.dart';
import 'build_configuration.dart';
import 'globals.dart';
import 'ios/devices.dart';
import 'ios/simulators.dart';
import 'toolchain.dart';
@@ -140,11 +143,6 @@ abstract class Device {
bool get supportsStartPaused => true;
String get fullDescription {
String supportIndicator = isSupported() ? '' : ' - unsupported';
return '$name ($id)$supportIndicator';
}
/// Whether it is an emulated device running on localhost.
bool get isLocalEmulator;
@@ -202,6 +200,23 @@ abstract class Device {
}
String toString() => name;
static void printDevices(List<Device> devices) {
int nameWidth = 0;
int idWidth = 0;
for (Device device in devices) {
nameWidth = math.max(nameWidth, device.name.length);
idWidth = math.max(idWidth, device.id.length);
}
for (Device device in devices) {
String supportIndicator = device.isSupported() ? '' : ' (unsupported)';
printStatus('${device.name.padRight(nameWidth)} • '
'${device.id.padRight(idWidth)} • '
'${getNameForTargetPlatform(device.platform)}$supportIndicator');
}
}
}
class ForwardedPort {

View File

@@ -47,8 +47,8 @@ abstract class FlutterCommand extends Command {
Stopwatch stopwatch = new Stopwatch()..start();
return _run().then((int exitCode) {
printTrace("'flutter $name' exiting with code $exitCode; "
"elasped time ${stopwatch.elapsedMilliseconds}ms.");
int ms = stopwatch.elapsedMilliseconds;
printTrace("'flutter $name' took ${ms}ms; exiting with code $exitCode.");
return exitCode;
});
}
@@ -90,8 +90,7 @@ abstract class FlutterCommand extends Command {
"the '-d <deviceId>' flag.");
printStatus('');
devices = await deviceManager.getAllConnectedDevices();
for (Device device in devices)
printStatus(device.fullDescription);
Device.printDevices(devices);
return 1;
} else {
_deviceForCommand = devices.single;

View File

@@ -72,9 +72,7 @@ class Template {
.replaceAll(_kCopyTemplateExtension, '')
.replaceAll(_kTemplateExtension, '');
File finalDestinationFile = new File(finalDestinationPath);
String relativePathForLogging = relativeDestPath
.replaceAll(_kCopyTemplateExtension, '')
.replaceAll(_kTemplateExtension, '');
String relativePathForLogging = path.relative(finalDestinationFile.path);
// Step 1: Check if the file needs to be overwritten.