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

Side by Side Diff: lib/src/options.dart

Issue 11275029: Support for specifying an output directory (issue #106) (Closed) Base URL: git@github.com:dart-lang/dart-web-components.git@master
Patch Set: Created 8 years, 1 month 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
« no previous file with comments | « lib/src/messages.dart ('k') | lib/web_component.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 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 file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library options; 5 library options;
6 6
7 import 'package:args/args.dart'; 7 import 'package:args/args.dart';
8 8
9 class CompilerOptions { 9 class CompilerOptions {
10 final bool warningsAsErrors; 10 final bool warningsAsErrors;
11 11
12 /** True to show informational messages. The `--verbose` flag. */ 12 /** True to show informational messages. The `--verbose` flag. */
13 final bool verbose; 13 final bool verbose;
14 14
15 /** Remove any generated files. */ 15 /** Remove any generated files. */
16 final bool clean; 16 final bool clean;
17 17
18 final bool useColors; 18 final bool useColors;
19 19
20 final List<String> rest; 20 final List<String> rest;
21 21
22 // We could make this faster, if it ever matters. 22 // We could make this faster, if it ever matters.
23 factory CompilerOptions() => parse(['']); 23 factory CompilerOptions() => parse(['']);
24 24
25 CompilerOptions.fromArgs(ArgResults args) 25 CompilerOptions.fromArgs(ArgResults args)
26 : warningsAsErrors = args['warnings_as_errors'], 26 : warningsAsErrors = args['warnings_as_errors'],
27 verbose = args['verbose'], 27 verbose = args['verbose'],
28 clean = args['clean'], 28 clean = args['clean'],
29 useColors = !args['colors'], 29 useColors = args['colors'],
30 rest = args.rest; 30 rest = args.rest;
31 31
32 static CompilerOptions parse(List<String> arguments) { 32 static CompilerOptions parse(List<String> arguments) {
33 var parser = new ArgParser() 33 var parser = new ArgParser()
34 ..addFlag('verbose', help: 'Display detail info', defaultsTo: false) 34 ..addFlag('verbose', help: 'Display detail info', defaultsTo: false)
35 ..addFlag('clean', help: 'Remove all generated files', defaultsTo: false) 35 ..addFlag('clean', help: 'Remove all generated files', defaultsTo: false)
36 ..addFlag('warnings_as_errors', help: 'Warning handled as errors', 36 ..addFlag('warnings_as_errors', help: 'Warning handled as errors',
37 defaultsTo: false) 37 defaultsTo: false)
38 ..addFlag('colors', help: 'Display errors/warnings in colored text', 38 ..addFlag('colors', help: 'Display errors/warnings in colored text',
39 defaultsTo: true) 39 defaultsTo: true)
40 ..addFlag('help', help: 'Displays this help message', defaultsTo: false); 40 ..addFlag('help', help: 'Displays this help message', defaultsTo: false);
41 41
42 var results = parser.parse(arguments); 42 var results = parser.parse(arguments);
43 if (results['help'] || results.rest.length == 0) { 43 if (results['help'] || results.rest.length == 0) {
44 print('Usage: [options...] sourcefile [outputPath]\n'); 44 print('Usage: [options...] sourcefile [outputPath]\n');
45 print(parser.getUsage()); 45 print(parser.getUsage());
46 print(" sourcefile - template file filename.html"); 46 print(" sourcefile - template file filename.html");
47 print(" outputPath - if specified directory to generate files; if not"); 47 print(" outputPath - if specified directory to generate files; if not");
48 print(" same directory as sourcefile"); 48 print(" same directory as sourcefile");
49 return null; 49 return null;
50 } 50 }
51 51
52 return new CompilerOptions.fromArgs(results); 52 return new CompilerOptions.fromArgs(results);
53 } 53 }
54 } 54 }
OLDNEW
« no previous file with comments | « lib/src/messages.dart ('k') | lib/web_component.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698