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

Unified Diff: lib/command_runner.dart

Issue 1812923003: Add an explicit distinction between a command's description and summary. (Closed) Base URL: git@github.com:dart-lang/args@master
Patch Set: Created 4 years, 9 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 | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/command_runner.dart
diff --git a/lib/command_runner.dart b/lib/command_runner.dart
index 3cc952ec63bf6d90658b8f4eae24f9d0852f8ca4..d0cbf261b9a28e2cd29dd53a462eb1f35451485b 100644
--- a/lib/command_runner.dart
+++ b/lib/command_runner.dart
@@ -190,9 +190,15 @@ abstract class Command {
/// The name of this command.
String get name;
- /// A short description of this command.
+ /// A description of this command, included in [usage].
String get description;
+ /// A short description of this command, included in [parent]'s
+ /// [CommandRunner.usage].
+ ///
+ /// This defaults to the first line of [description].
+ String get summary => description.split("\n").first;
+
/// A single-line template for how to invoke this command (e.g. `"pub get
/// [package]"`).
String get invocation {
@@ -371,7 +377,7 @@ String _getCommandUsage(Map<String, Command> commands,
var buffer =
new StringBuffer('Available ${isSubcommand ? "sub" : ""}commands:');
for (var name in names) {
- var lines = commands[name].description.split("\n");
+ var lines = commands[name].summary.split("\n");
buffer.writeln();
buffer.write(' ${padRight(name, length)} ${lines.first}');
« no previous file with comments | « CHANGELOG.md ('k') | pubspec.yaml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698