From 51768648d36b26fc35fe61ceaa2dd3ad7e24fbd6 Mon Sep 17 00:00:00 2001 From: Jean Privat Date: Thu, 4 Dec 2014 22:32:34 -0500 Subject: [PATCH] nitls: use tree-output if one of the argument is a group Signed-off-by: Jean Privat --- src/nitls.nit | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/src/nitls.nit b/src/nitls.nit index c28ecb1..3e6126a 100644 --- a/src/nitls.nit +++ b/src/nitls.nit @@ -134,7 +134,7 @@ if sum > 1 then print tc.tooldescription exit 1 end - +if sum == 0 then opt_project.value = true tc.keep_going = opt_keep.value var model = new Model @@ -160,6 +160,18 @@ else files = tc.option_context.rest end +if sum == 0 then + # If one of the file is a group, default is `opt_tree` instead of `opt_project` + for a in files do + var g = mb.get_mgroup(a) + if g != null then + opt_tree.value = true + opt_project.value = false + break + end + end +end + for a in files do var mp = mb.identify_file(a) tc.check_errors @@ -172,7 +184,6 @@ for a in files do end end -if sum == 0 then opt_project.value = true var ot = new ProjTree(tc) var sorter = new AlphaEntityComparator -- 1.7.9.5