OLD | NEW |
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 csslib.src.options; | 5 library csslib.src.options; |
6 | 6 |
7 import 'package:args/args.dart'; | 7 import 'package:args/args.dart'; |
8 | 8 |
9 class PreprocessorOptions { | 9 class PreprocessorOptions { |
10 /** Generate polyfill code (e.g., var, etc.) */ | 10 /** Generate polyfill code (e.g., var, etc.) */ |
(...skipping 20 matching lines...) Expand all Loading... |
31 * Less syntax supported: | 31 * Less syntax supported: |
32 * - @name at root level statically defines variables resolved at compilation | 32 * - @name at root level statically defines variables resolved at compilation |
33 * time. Essentially a directive e.g., @var-name. | 33 * time. Essentially a directive e.g., @var-name. |
34 */ | 34 */ |
35 final bool lessSupport; | 35 final bool lessSupport; |
36 | 36 |
37 /** Whether to use colors to print messages on the terminal. */ | 37 /** Whether to use colors to print messages on the terminal. */ |
38 final bool useColors; | 38 final bool useColors; |
39 | 39 |
40 /** File to process by the compiler. */ | 40 /** File to process by the compiler. */ |
41 String inputFile; | 41 final String inputFile; |
42 | 42 |
43 // We could make this faster, if it ever matters. | 43 const PreprocessorOptions({this.verbose: false, this.checked: false, |
44 factory PreprocessorOptions() => parse(['']); | 44 this.lessSupport: true, this.warningsAsErrors: false, |
| 45 this.throwOnErrors: false, this.throwOnWarnings: false, |
| 46 this.useColors: true, this.polyfill: false, this.inputFile}); |
45 | 47 |
46 PreprocessorOptions.fromArgs(ArgResults args) | 48 PreprocessorOptions.fromArgs(ArgResults args) |
47 : warningsAsErrors = args['warnings_as_errors'], | 49 : warningsAsErrors = args['warnings_as_errors'], |
48 throwOnWarnings = args['throw_on_warnings'], | 50 throwOnWarnings = args['throw_on_warnings'], |
49 throwOnErrors = args['throw_on_errors'], | 51 throwOnErrors = args['throw_on_errors'], |
50 verbose = args['verbose'], | 52 verbose = args['verbose'], |
51 checked = args['checked'], | 53 checked = args['checked'], |
52 lessSupport = args['less'], | 54 lessSupport = args['less'], |
53 useColors = args['colors'], | 55 useColors = args['colors'], |
54 polyfill = args['polyfill'], | 56 polyfill = args['polyfill'], |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 showUsage(parser); | 102 showUsage(parser); |
101 return null; | 103 return null; |
102 } | 104 } |
103 } | 105 } |
104 | 106 |
105 static showUsage(parser) { | 107 static showUsage(parser) { |
106 print('Usage: css [options...] input.css'); | 108 print('Usage: css [options...] input.css'); |
107 print(parser.getUsage()); | 109 print(parser.getUsage()); |
108 } | 110 } |
109 } | 111 } |
OLD | NEW |