nitls: reuse ProjTree::display for the simple list
[nit.git] / src / nitls.nit
index 54320cc..fc6bd41 100644 (file)
@@ -17,7 +17,8 @@
 # Simple tool to list Nit source files
 module nitls
 
-intrude import modelbuilder
+import modelbuilder
+intrude import loader
 import ordered_tree
 
 class ProjTree
@@ -73,6 +74,8 @@ if sum > 1 then
        exit 1
 end
 
+tc.keep_going = opt_keep.value
+
 var model = new Model
 var mb = new ModelBuilder(model, tc)
 
@@ -106,15 +109,15 @@ else
        for a in files do
                var mp = mb.identify_file(a)
                if mp == null then
-                       if not opt_keep.value then tc.check_errors
+                       tc.check_errors
                end
        end
 end
 
 if sum == 0 then opt_project.value = true
 
+var ot = new ProjTree
 if opt_tree.value then
-       var ot = new ProjTree
        ot.opt_paths = opt_paths.value
        for p in model.mprojects do
                for g in p.mgroups do
@@ -136,7 +139,7 @@ if opt_source.value then
                                if opt_paths.value then
                                        list.add(mp.filepath)
                                else
-                                       list.add("{g.full_name}/{mp.name} ({mp.filepath})")
+                                       list.add("{g.full_name}/{ot.display(mp)}")
                                end
                        end
                end