@echo '***************************************************************'
@echo '* Generate doc for NIT standard library *'
@echo '***************************************************************'
- bin/nitdoc $$(bin/nitls lib -r) -d doc/stdlib \
+ bin/nitdoc $$(bin/nitls lib -r --path) -d doc/stdlib \
--custom-title "Nit Standard Library" \
--custom-menu-items "<li><a href=\"http://nitlanguage.org/\">Nitlanguage.org</a></li>" \
--custom-overview-text "<p>Documentation for the standard library of Nit<br/>Version $$(git describe)<br/>Date: $$(git show --format="%cd" | head -1)</p>" \
intrude import modelbuilder
import ordered_tree
+class ProjTree
+ super OrderedTree[Object]
+
+ var opt_paths = false
+
+ redef fun display(o)
+ do
+ if o isa MGroup then
+ if opt_paths then
+ return o.filepath.as(not null)
+ else
+ return "{o.name} ({o.filepath})"
+ end
+ else if o isa ModulePath then
+ if opt_paths then
+ return o.filepath
+ else
+ return "{o.name} ({o.filepath})"
+ end
+ else
+ abort
+ end
+ end
+end
+
var tc = new ToolContext
var model = new Model
var mb = new ModelBuilder(model, tc)
var opt_source = new OptionBool("List source files", "-s", "--source")
var opt_project = new OptionBool("List projects paths (default)", "-p", "--project")
var opt_depends = new OptionBool("List dependencies of given modules", "-M", "--depends")
+var opt_paths = new OptionBool("List only path (instead of name + path)", "-p", "--path")
-tc.option_context.add_option(opt_keep, opt_recursive, opt_tree, opt_source, opt_project, opt_depends)
+tc.option_context.add_option(opt_keep, opt_recursive, opt_tree, opt_source, opt_project, opt_depends, opt_paths)
tc.tooldescription = "Usage: nitls [OPTION]... <file.nit|directory>...\nLists the projects and/or paths of Nit sources files."
tc.process_options(args)
end
if opt_tree.value then
- var ot = new OrderedTree[Object]
+ var ot = new ProjTree
+ ot.opt_paths = opt_paths.value
for p in model.mprojects do
for g in p.mgroups do
ot.add(g.parent, g)
for p in model.mprojects do
for g in p.mgroups do
for mp in g.module_paths do
- list.add(mp.filepath)
+ if opt_paths.value then
+ list.add(mp.filepath)
+ else
+ list.add("{g.full_name}/{mp.name} ({mp.filepath})")
+ end
end
end
end
if opt_project.value then
var list = new Array[String]
for p in model.mprojects do
- list.add(p.root.filepath.as(not null))
+ var path = p.root.filepath.as(not null)
+ if opt_paths.value then
+ list.add(path)
+ else
+ list.add("{p.name} ({path})")
+ end
end
alpha_comparator.sort(list)
for l in list do print l