Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(48)

Side by Side Diff: pkg/fletchc/lib/src/verbs/show_verb.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE.md file.
4
5 library fletchc.verbs.show_verb;
6
7 import 'infrastructure.dart';
8
9 import 'documentation.dart' show
10 showDocumentation;
11
12 import '../diagnostic.dart' show
13 throwInternalError;
14
15 import '../worker/developer.dart' show
16 discoverDevices,
17 showSessions,
18 showSessionSettings;
19
20 const Action showAction = const Action(
21 show, showDocumentation, requiresSession: true,
22 requiresTarget: true,
23 supportedTargets: const <TargetKind>[
24 TargetKind.DEVICES,
25 TargetKind.LOG,
26 TargetKind.SESSIONS,
27 TargetKind.SETTINGS,
28 ]);
29
30 Future<int> show(AnalyzedSentence sentence, VerbContext context) {
31 switch (sentence.target.kind) {
32 case TargetKind.LOG:
33 return context.performTaskInWorker(const ShowLogTask());
34 case TargetKind.DEVICES:
35 return context.performTaskInWorker(const ShowDevicesTask());
36 case TargetKind.SESSIONS:
37 showSessions();
38 return new Future.value(0);
39 case TargetKind.SETTINGS:
40 return context.performTaskInWorker(const ShowSettingsTask());
41 default:
42 throwInternalError("Unexpected ${sentence.target}");
43 }
44 }
45
46 class ShowLogTask extends SharedTask {
47 // Keep this class simple, see note in superclass.
48
49 const ShowLogTask();
50
51 Future<int> call(
52 CommandSender commandSender,
53 StreamIterator<ClientCommand> commandIterator) {
54 return showLogTask();
55 }
56 }
57
58 Future<int> showLogTask() async {
59 print(SessionState.current.getLog());
60 return 0;
61 }
62
63 class ShowDevicesTask extends SharedTask {
64 // Keep this class simple, see note in superclass.
65
66 const ShowDevicesTask();
67
68 Future<int> call(
69 CommandSender commandSender,
70 StreamIterator<ClientCommand> commandIterator) {
71 return showDevicesTask();
72 }
73 }
74
75 Future<int> showDevicesTask() async {
76 await discoverDevices();
77 return 0;
78 }
79
80 class ShowSettingsTask extends SharedTask {
81 // Keep this class simple, see note in superclass.
82
83 const ShowSettingsTask();
84
85 Future<int> call(
86 CommandSender commandSender,
87 StreamIterator<ClientCommand> commandIterator) async {
88 return await showSessionSettings();
89 }
90 }
OLDNEW
« no previous file with comments | « pkg/fletchc/lib/src/verbs/run_verb.dart ('k') | pkg/fletchc/lib/src/verbs/x_download_tools_verb.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698