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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
# File 'lib/CoffeeTags.rb', line 33
def self.option_parser args
args << '-h' if args.empty?
options = {}
optparse = OptionParser.new do |opts|
opts.banner = (<<-BAN
---------------------------------------------------------------------
#{NAME} #{Coffeetags::VERSION}
---------------------------------------------------------------------
by #{AUTHOR} ( #{URL} )
Usage:
coffeetags [OPTIONS] <list of files>
CoffeeTags + TagBar + Vim ---> https://gist.github.com/1935512
---------------------------------------------------------------------
BAN
).gsub(/^\s*/,'')
opts.on('--include-vars', "Include variables in generated tags") do |o|
options[:include_vars] = true
end
opts.on('-f', '--file FILE', 'Write tags to FILE (use - for std out)') do |o|
options[:output] = o unless o == '-'
end
opts.on('-R', '--recursive', 'Process current directory recursively') do |o|
options[:recur] = true
end
opts.on('--vim-conf', 'Generate TagBar config (more info https://gist.github.com/1935512 )') do
puts tagbar_conf options[:include_vars]
exit
end
opts.on('-v', '--version', 'Current version') do
puts Coffeetags::VERSION
exit
end
opts.on('-h','--help','HALP') do
puts opts
exit
end
end
optparse.parse! args
options[:files] = args.to_a
options[:files] += Dir['./**/*.coffee', './**/Cakefile'] if options[:recur]
[
options[:output],
options[:include_vars],
options[:files]
]
end
|