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

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

Issue 23819036: Support for @mixin, @include and @extend (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: All changes ready to commit Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « pkg/csslib/lib/src/messages.dart ('k') | pkg/csslib/lib/src/polyfill.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 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.) */
11 final bool polyfill;
12
10 /** Report warnings as errors. */ 13 /** Report warnings as errors. */
11 final bool warningsAsErrors; 14 final bool warningsAsErrors;
12 15
13 /** Throw an exception on warnings (not used by command line tool). */ 16 /** Throw an exception on warnings (not used by command line tool). */
14 final bool throwOnWarnings; 17 final bool throwOnWarnings;
15 18
16 /** Throw an exception on errors (not used by command line tool). */ 19 /** Throw an exception on errors (not used by command line tool). */
17 final bool throwOnErrors; 20 final bool throwOnErrors;
18 21
19 /** True to show informational messages. The `--verbose` flag. */ 22 /** True to show informational messages. The `--verbose` flag. */
(...skipping 21 matching lines...) Expand all
41 factory PreprocessorOptions() => parse(['']); 44 factory PreprocessorOptions() => parse(['']);
42 45
43 PreprocessorOptions.fromArgs(ArgResults args) 46 PreprocessorOptions.fromArgs(ArgResults args)
44 : warningsAsErrors = args['warnings_as_errors'], 47 : warningsAsErrors = args['warnings_as_errors'],
45 throwOnWarnings = args['throw_on_warnings'], 48 throwOnWarnings = args['throw_on_warnings'],
46 throwOnErrors = args['throw_on_errors'], 49 throwOnErrors = args['throw_on_errors'],
47 verbose = args['verbose'], 50 verbose = args['verbose'],
48 checked = args['checked'], 51 checked = args['checked'],
49 lessSupport = args['less'], 52 lessSupport = args['less'],
50 useColors = args['colors'], 53 useColors = args['colors'],
54 polyfill = args['polyfill'],
51 inputFile = args.rest.length > 0 ? args.rest[0] : null; 55 inputFile = args.rest.length > 0 ? args.rest[0] : null;
52 56
53 // tool.dart [options...] <css file> 57 // tool.dart [options...] <css file>
54 static PreprocessorOptions parse(List<String> arguments) { 58 static PreprocessorOptions parse(List<String> arguments) {
55 var parser = new ArgParser() 59 var parser = new ArgParser()
56 ..addFlag('verbose', abbr: 'v', defaultsTo: false, negatable: false, 60 ..addFlag('verbose', abbr: 'v', defaultsTo: false, negatable: false,
57 help: 'Display detail info') 61 help: 'Display detail info')
58 ..addFlag('checked', defaultsTo: false, negatable: false, 62 ..addFlag('checked', defaultsTo: false, negatable: false,
59 help: 'Validate CSS values invalid value display a warning message') 63 help: 'Validate CSS values invalid value display a warning message')
60 ..addFlag('less', defaultsTo: true, negatable: true, 64 ..addFlag('less', defaultsTo: true, negatable: true,
61 help: 'Supports subset of Less syntax') 65 help: 'Supports subset of Less syntax')
62 ..addFlag('suppress_warnings', defaultsTo: true, 66 ..addFlag('suppress_warnings', defaultsTo: true,
63 help: 'Warnings not displayed') 67 help: 'Warnings not displayed')
64 ..addFlag('warnings_as_errors', defaultsTo: false, 68 ..addFlag('warnings_as_errors', defaultsTo: false,
65 help: 'Warning handled as errors') 69 help: 'Warning handled as errors')
66 ..addFlag('throw_on_errors', defaultsTo: false, 70 ..addFlag('throw_on_errors', defaultsTo: false,
67 help: 'Throw on errors encountered') 71 help: 'Throw on errors encountered')
68 ..addFlag('throw_on_warnings', defaultsTo: false, 72 ..addFlag('throw_on_warnings', defaultsTo: false,
69 help: 'Throw on warnings encountered') 73 help: 'Throw on warnings encountered')
70 ..addFlag('colors', defaultsTo: true, 74 ..addFlag('colors', defaultsTo: true,
71 help: 'Display errors/warnings in colored text') 75 help: 'Display errors/warnings in colored text')
76 ..addFlag('polyfill', defaultsTo: false,
77 help: 'Generate polyfill for new CSS features')
72 ..addFlag('help', abbr: 'h', defaultsTo: false, negatable: false, 78 ..addFlag('help', abbr: 'h', defaultsTo: false, negatable: false,
73 help: 'Displays this help message'); 79 help: 'Displays this help message');
74 80
75 try { 81 try {
76 var results = parser.parse(arguments); 82 var results = parser.parse(arguments);
77 if (results['help'] || results.rest.length == 0) { 83 if (results['help'] || results.rest.length == 0) {
78 showUsage(parser); 84 showUsage(parser);
79 return null; 85 return null;
80 } 86 }
81 return new PreprocessorOptions.fromArgs(results); 87 return new PreprocessorOptions.fromArgs(results);
82 } on FormatException catch (e) { 88 } on FormatException catch (e) {
83 print(e.message); 89 print(e.message);
84 showUsage(parser); 90 showUsage(parser);
85 return null; 91 return null;
86 } 92 }
87 } 93 }
88 94
89 static showUsage(parser) { 95 static showUsage(parser) {
90 print('Usage: css [options...] input.css'); 96 print('Usage: css [options...] input.css');
91 print(parser.getUsage()); 97 print(parser.getUsage());
92 } 98 }
93 99
94 } 100 }
OLDNEW
« no previous file with comments | « pkg/csslib/lib/src/messages.dart ('k') | pkg/csslib/lib/src/polyfill.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698