lib/activefacts/generate/help.rb in activefacts-0.8.16 vs lib/activefacts/generate/help.rb in activefacts-0.8.18
- old
+ new
@@ -12,22 +12,40 @@
# Invoke as
# afgen --null <file>.cql
class HELP
private
def initialize(vocabulary, *options)
+ generators = $:.
+ map{|path|
+ Dir[path+"/activefacts/generate/**/*.rb"].
+ reject{|p|
+ p =~ %r{/(transform|helpers)/}
+ }.
+ map{|p|
+ p.sub(%r{.*/activefacts/generate/}, '').sub(/\.rb/,'')
+ }
+ }
+ transformers = $:.
+ map{|path|
+ Dir[path+"/activefacts/generate/transform/**/*.rb"].
+ map{|p|
+ p.sub(%r{.*/activefacts/generate/}, '').sub(/\.rb/,'')
+ }
+ }
+
puts %Q{
-Usage: afgen --generator[=options] file.inp[=options]
+Usage: afgen [ --transformer[=options] ... ] [ --generator[=options] ... ] file.inp[=options]
options are comma-separated lists. Use =help to get more information.
Available generators are:
- #{$:.map{|path|
- Dir[path+"/activefacts/generate/**.rb"].map{|p|
- p.sub(%r{.*/}, '').sub(/\.rb/,'')
- }
- }.flatten.uniq.sort.join("\n\t")
+ #{generators.flatten.uniq.sort.join("\n\t")
}
+Available transformers are:
+ #{transformers.flatten.uniq.sort.join("\n\t")
+}
+
inp is the name of a file input handler. Available input handlers are:
#{$:.map{|path|
Dir[path+"/activefacts/input/**.rb"].map{|p|
p.sub(%r{.*/}, '').sub(/\.rb/,'')
}
@@ -41,5 +59,6 @@
end
end
end
end
+ActiveFacts::Registry.generator('help', ActiveFacts::Generate::HELP)