@@ -65,24 +65,51 @@ object ResultBeautifier {
6565
6666 def beautifyRetrieveResults (results : Seq [RetrieveResult ]) : String = {
6767 results.map { r =>
68- val at = new AsciiTable ()
69-
70- at.addRule()
7168
72- // add body
73- for (
74- (key, value) <- r.metricResults.toList.sortBy(x => x._1)
75- ) {
76- val ar = at.addRow(Seq (key, value).asJavaCollection)
77- asScalaBuffer(ar.getCells).tail.foreach { c => c.getContext.setTextAlignment(TextAlignment .RIGHT )}
69+ val basedata = {
70+ val at = new AsciiTable ()
71+
72+ at.addRule()
73+
74+ at.addRow(" source" , r.metadata.source)
75+ at.addRow(" artifactId" , r.metadata.artifactId)
76+ at.addRow(" groupId" , r.metadata.groupId)
77+ at.addRow(" version" , r.metadata.version)
78+ at.addRow(" discovered at" , r.metadata.discovered)
79+ at.addRule()
80+ at.getRenderer.setCWC(new CWC_LongestLine )
81+ at.setPaddingLeftRight(1 )
82+ at.getContext.setFrameLeftMargin(2 )
83+ " ↳ Basic information" + System .lineSeparator() + at.render() + System .lineSeparator()
7884 }
7985
80- at.addRule()
86+ val metrics = r.metricResults.size match {
87+ case 0 => " "
88+ case _ => {
89+ val at = new AsciiTable ()
8190
82- at.getRenderer.setCWC(new CWC_LongestLine )
83- at.setPaddingRight(1 )
91+ at.addRule()
92+
93+ // add body
94+ for (
95+ (key, value) <- r.metricResults.toList.sortBy(x => x._1)
96+ ) {
97+ val ar = at.addRow(Seq (key, value).asJavaCollection)
98+ asScalaBuffer(ar.getCells).tail.foreach { c => c.getContext.setTextAlignment(TextAlignment .RIGHT )}
99+ }
100+
101+ at.addRule()
102+
103+ at.getRenderer.setCWC(new CWC_LongestLine )
104+ at.setPaddingLeftRight(1 )
105+ at.getContext.setFrameLeftMargin(2 )
106+ at.getContext.setFrameBottomMargin(1 )
107+ " ↳ Metrics:" + System .lineSeparator() + at.render()
108+ }
109+ }
110+
111+ System .lineSeparator() + r.toMavenIdentifier() + System .lineSeparator() + basedata + metrics + System .lineSeparator()
84112
85- System .lineSeparator() + r.toMavenIdentifier() + System .lineSeparator() + at.render()
86113 }.fold(" " )(_ + _)
87114 }
88115}
0 commit comments