7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
# File 'lib/coffeelint/cmd.rb', line 7
def self.parse_options(name = 'coffeelint.rb')
options = {
:recursive => false,
:noconfig => false,
:stdin => false,
:quiet => false,
}
linter_options = {}
opt_parser = OptionParser.new do |opts|
opts.banner = "Usage: coffeelint.rb [options] source [...]"
=begin
-f, --file Specify a custom configuration file.
--noconfig Ignores the environment variable COFFEELINT_CONFIG. [boolean]
-h, --help Print help information.
-v, --version Print current version number.
-r Recursively lint .coffee files in subdirectories. [boolean]
--csv Use the csv reporter. [boolean]
--jslint Use the JSLint XML reporter. [boolean]
--nocolor Don't colorize the output [boolean]
-s, --stdin Lint the source from stdin [boolean]
-q, --quiet Only print errors. [boolean]
=end
opts.on "-f FILE", "--file FILE", "Specify a custom configuration file." do |f|
linter_options[:config_file] = f
end
=begin
opts.on "--noconfig", "Ignores the environment variabel COFFEELINT_CONFIG." do |f|
options[:noconfig] = true
end
=end
opts.on_tail "-h", "--help", "Print help information." do
puts opts
exit
end
opts.on_tail "-v", "--version", "Print current version number." do
puts Coffeelint::VERSION
exit
end
opts.on '-r', "Recursively lint .coffee files in subdirectories." do
options[:recursive] = true
end
=begin
opts.on '-s', '--stdin', "Lint the source from stdin" do
options[:stdin] = true
end
opts.on '-q', '--quiet', 'Only print errors.' do
options[:quiet] = true
end
=end
end
opt_parser.parse!
return {
:options => options,
:linter_options => linter_options
}
end
|