init(toolcontext: ToolContext) do
# We need a model to collect stufs
self.toolcontext = toolcontext
- self.toolcontext.option_context.options.clear
self.arguments = toolcontext.option_context.rest
- if arguments.is_empty or arguments.length > 2 then
- print "usage: ni path/to/module.nit [expression]"
- toolcontext.option_context.usage
+ if arguments.length > 2 then
+ print toolcontext.tooldescription
exit(1)
end
# Create a tool context to handle options and paths
var toolcontext = new ToolContext
-toolcontext.process_options
+toolcontext.tooldescription = "Usage: nitx [OPTION]... <file.nit> [query]\nDisplays specific pieces of API information from Nit source files."
+toolcontext.process_options(args)
# Here we launch the nit index
var ni = new NitIndex(toolcontext)