OLD | NEW |
1 #!/usr/bin/env dart | 1 #!/usr/bin/env dart |
2 | 2 |
3 /// Converts block-style Doc comments in Dart code to line style. | 3 /// Converts block-style Doc comments in Dart code to line style. |
4 library line_doc_comments; | 4 library line_doc_comments; |
5 import 'dart:io'; | 5 import 'dart:io'; |
6 | 6 |
7 import '../pkg/path/lib/path.dart' as path; | 7 import '../pkg/path/lib/path.dart' as path; |
8 | 8 |
9 final oneLineBlock = new RegExp(r'^(\s*)/\*\*\s?(.*)\*/\s*$'); | 9 final oneLineBlock = new RegExp(r'^(\s*)/\*\*\s?(.*)\*/\s*$'); |
10 final startBlock = new RegExp(r'^(\s*)/\*\*(.*)$'); | 10 final startBlock = new RegExp(r'^(\s*)/\*\*(.*)$'); |
11 final blockLine = new RegExp(r'^\s*\*\s?(.*)$'); | 11 final blockLine = new RegExp(r'^\s*\*\s?(.*)$'); |
12 final endBlock = new RegExp(r'^\s*\*/\s*$'); | 12 final endBlock = new RegExp(r'^\s*\*/\s*$'); |
13 | 13 |
14 main() { | 14 main(List<String> args) { |
15 var args = new Options().arguments; | |
16 if (args.length != 1) { | 15 if (args.length != 1) { |
17 print('Converts "/**"-style block doc comments in a directory '); | 16 print('Converts "/**"-style block doc comments in a directory '); |
18 print('containing Dart code to "///"-style line doc comments.'); | 17 print('containing Dart code to "///"-style line doc comments.'); |
19 print(''); | 18 print(''); |
20 print('Usage: line_doc_coments.dart <dir>'); | 19 print('Usage: line_doc_coments.dart <dir>'); |
21 return; | 20 return; |
22 } | 21 } |
23 | 22 |
24 var dir = new Directory(args[0]); | 23 var dir = new Directory(args[0]); |
25 dir.list(recursive: true).listen( | 24 dir.list(recursive: true).listen( |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 } | 80 } |
82 } | 81 } |
83 } | 82 } |
84 } | 83 } |
85 | 84 |
86 if (line != null) buffer.write('$line\n'); | 85 if (line != null) buffer.write('$line\n'); |
87 } | 86 } |
88 | 87 |
89 return buffer.toString(); | 88 return buffer.toString(); |
90 } | 89 } |
OLD | NEW |