From 5a0bb0524468709c5d3f31238cd996209409ea47 Mon Sep 17 00:00:00 2001 From: Alexandre Terrasa Date: Fri, 21 Jun 2013 15:29:12 -0400 Subject: [PATCH] ni: now search for properties by their name Signed-off-by: Alexandre Terrasa --- src/ni.nit | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/src/ni.nit b/src/ni.nit index 2d5791a..26f6d20 100644 --- a/src/ni.nit +++ b/src/ni.nit @@ -106,7 +106,7 @@ class NitIndex matches.add(p) end end - #if not matches.is_empty then doc_properties + if not matches.is_empty then props_fulldoc(matches) if not flag then print "Nothing known about '{entry}'" if arguments.length == 1 then prompt @@ -208,6 +208,28 @@ class NitIndex end pager.render end + + private fun props_fulldoc(mprops: List[MProperty]) do + var pager = new Pager + for mprop in mprops do + var nprop = mbuilder.mpropdef2npropdef[mprop.intro] + if nprop isa AMethPropdef then + pager.add("# {mprop.intro_mclassdef.namespace.bold}\n") + if not nprop.short_comment.is_empty then + pager.add("\t# {nprop.short_comment}") + end + pager.add("\t{nprop}") + pager.add("\t\t" + "introduced in {mprop.intro_mclassdef.namespace}".gray) + for mpropdef in mprop.mpropdefs do + if mpropdef != mprop.intro then + pager.add("\t\t" + "refined in {mpropdef.mclassdef.namespace}".gray) + end + end + end + pager.add_rule + end + pager.render + end end # Printing facilities -- 1.7.9.5