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

Unified Diff: pkg/fletchc/lib/src/verbs/help_verb.dart

Issue 1659163007: Rename fletch -> dartino (Closed) Base URL: https://github.com/dartino/sdk.git@master
Patch Set: address comments Created 4 years, 11 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « pkg/fletchc/lib/src/verbs/export_verb.dart ('k') | pkg/fletchc/lib/src/verbs/infrastructure.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/fletchc/lib/src/verbs/help_verb.dart
diff --git a/pkg/fletchc/lib/src/verbs/help_verb.dart b/pkg/fletchc/lib/src/verbs/help_verb.dart
deleted file mode 100644
index 97b6ad05a18f4c427b1c689dfbb5b824f7afe6ef..0000000000000000000000000000000000000000
--- a/pkg/fletchc/lib/src/verbs/help_verb.dart
+++ /dev/null
@@ -1,73 +0,0 @@
-// Copyright (c) 2015, the Dartino project authors. Please see the AUTHORS file
-// for details. All rights reserved. Use of this source code is governed by a
-// BSD-style license that can be found in the LICENSE.md file.
-
-library fletchc.verbs.help_verb;
-
-import 'infrastructure.dart';
-
-import 'actions.dart' show
- commonActions,
- uncommonActions;
-
-import 'documentation.dart' show
- helpDocumentation,
- synopsis;
-
-const Action helpAction =
- const Action(
- help, helpDocumentation,
- supportedTargets: const [ TargetKind.ALL ], allowsTrailing: true);
-
-Future<int> help(AnalyzedSentence sentence, _) async {
- int exitCode = 0;
- bool showAllActions = sentence.target != null;
- if (sentence.trailing != null) {
- exitCode = 1;
- }
- if (sentence.verb.name != "help") {
- exitCode = 1;
- }
- print(generateHelpText(showAllActions));
- return exitCode;
-}
-
-String generateHelpText(bool showAllActions) {
- List<String> helpStrings = <String>[synopsis];
- addAction(String name, Action action) {
- helpStrings.add("");
- List<String> lines = action.documentation.trimRight().split("\n");
- for (int i = 0; i < lines.length; i++) {
- String line = lines[i];
- if (line.length > 80) {
- throw new StateError(
- "Line ${i+1} of Action '$name' is too long and may not be "
- "visible in a normal terminal window: $line\n"
- "Please trim to 80 characters or fewer.");
- }
- helpStrings.add(lines[i]);
- }
- }
- List<String> names = <String>[]..addAll(commonActions.keys);
- if (showAllActions) {
- names.addAll(uncommonActions.keys);
- }
- if (showAllActions) {
- names.sort();
- }
- for (String name in names) {
- Action action = commonActions[name];
- if (action == null) {
- action = uncommonActions[name];
- }
- addAction(name, action);
- }
-
- if (!showAllActions && helpStrings.length > 20) {
- throw new StateError(
- "More than 20 lines in the combined documentation of [commonActions]. "
- "The documentation may scroll out of view:\n${helpStrings.join('\n')}."
- "Can you shorten the documentation?");
- }
- return helpStrings.join("\n");
-}
« no previous file with comments | « pkg/fletchc/lib/src/verbs/export_verb.dart ('k') | pkg/fletchc/lib/src/verbs/infrastructure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698