Skip to content

Commit

Permalink
generate cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
kevmoo committed May 4, 2016
1 parent 5f06161 commit c8e6512
Showing 1 changed file with 4 additions and 7 deletions.
11 changes: 4 additions & 7 deletions lib/src/generate.dart
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import 'dart:convert';
import 'dart:io';

import 'package:bot/bot.dart';
import 'package:path/path.dart' as pathos;

const _BIN_NAME_REPLACEMENT = '{{binName}}';
Expand All @@ -26,8 +26,6 @@ final _binNameMatch = new RegExp(r'^[a-zA-Z0-9]((\w|-|\.)*[a-zA-Z0-9])?$');
*/

String generateCompletionScript(List<String> binaryNames) {
final binNames = new List<String>();

if (binaryNames.isEmpty) {
throw new ArgumentError('Provide the name of at least of one command');
}
Expand All @@ -40,17 +38,16 @@ String generateCompletionScript(List<String> binaryNames) {
}
}

binNames.addAll(binaryNames);

var buffer = new StringBuffer();

final prefix = Util.splitLines(_PREFIX).map((l) => '# $l'.trim()).join('\n');
final prefix =
LineSplitter.split(_PREFIX).map((l) => '# $l'.trim()).join('\n');
buffer.writeln(prefix);

// empty line
buffer.writeln('');

for (final binName in binNames) {
for (final binName in binaryNames) {
buffer.writeln(_printBinName(binName));
}

Expand Down

0 comments on commit c8e6512

Please sign in to comment.