mirror of
https://github.com/elastic/logstash.git
synced 2025-04-24 06:37:19 -04:00
- more docgen
This commit is contained in:
parent
01d1d594c1
commit
06a353fc87
2 changed files with 2 additions and 31 deletions
|
@ -1,5 +1,7 @@
|
|||
require "rubygems"
|
||||
|
||||
$: << File.join(File.dirname(__FILE__), "..", "lib")
|
||||
|
||||
class LogStashConfigDocGenerator
|
||||
COMMENT_RE = /^ *#(.*)/
|
||||
|
||||
|
|
31
docgen.rb
31
docgen.rb
|
@ -1,31 +0,0 @@
|
|||
|
||||
class LogStashConfigDocGenerator
|
||||
COMMENT_RE = /^ *#(.*)/
|
||||
RULES = {
|
||||
COMMENT_RE => lambda { |m| add_comment(m[1]) },
|
||||
/^ *config .*/ => lambda { |m| add_config(m[0]) },
|
||||
}
|
||||
|
||||
def parse(string)
|
||||
buffer = ""
|
||||
string.split("\n").each do |line|
|
||||
|
||||
if line =~ COMMENT_RE
|
||||
# nothing
|
||||
else
|
||||
# Join extended lines
|
||||
if line =~ /(, *$)|(\\$)/
|
||||
buffer += line.gsub(/\\$/, "")
|
||||
next
|
||||
end
|
||||
end
|
||||
|
||||
p line
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
if __FILE__ == $0
|
||||
gen = LogStashConfigDocGenerator.new
|
||||
gen.parse(File.new(ARGV[0]).read)
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue