lib/alf/shell/doc_manager.rb in alf-shell-0.13.1 vs lib/alf/shell/doc_manager.rb in alf-shell-0.14.0
- old
+ new
@@ -7,12 +7,12 @@
#
# Called by Quickl when it's time to generate documentation of `cmd`.
#
def call(cmd, options = {})
- if File.exists?(file = find_file(cmd))
- text = File.read(file)
+ if (file = find_file(cmd)).file?
+ text = file.read
# Replace occurences of #{signature} to #{signature.to_xxx}
# according to options
method = (options[:method] || "shell").to_s
text = text.gsub('#(signature)', '#(signature.to_' + method + ')')
@@ -52,11 +52,12 @@
def run_alf_command(argv, requester = nil)
argv = Quickl.parse_commandline_args(argv) if argv.is_a?(String)
argv = Quickl.split_commandline_args(argv, '|')
argv.inject(nil) do |cmd,arr|
arr.shift if arr.first == "alf"
- main = Alf::Shell::Main.new(Alf.examples)
+ main = Alf::Shell::Main.new(Alf::Shell::DEFAULT_CONFIG)
+ main.config.adapter = Alf.examples_adapter
main.stdin_operand = cmd unless cmd.nil?
main.run(arr, requester)
end
end
@@ -73,10 +74,10 @@
elsif cmd.operator? && cmd.non_relational?
File.join("operators", "non_relational")
else
raise "Unexpected command #{cmd}"
end
- File.join(DOC_FOLDER, where, "#{cmd.command_name}.md")
+ DOC_FOLDER/where/"#{cmd.command_name}.md"
end
end # class DocManager
end # module Shell
end # module Alf