let plugin = require('..').plugin 
let _ = require('underscore')

let ep = plugin.extensionPoints['http.endpoint']

exports.listRoutes = (println, tokens) => {
  let endpoints = ep.array

  println('Available end points')
  endpoints.forEach((endpoint) => {
    let method = endpoint.method || 'all'
    let line = '\t' + method + '\t' + endpoint.path
    if (endpoint.directory) {
      line += '/*'
    }
    if (endpoint.description) {
      line += '\t' + endpoint.description
    } else if (endpoint.directory) {
      line += 'static' 
    }

    if (endpoint.directory) {
      line += ' - ' + endpoint.directory
    }

    println(line)
  })
  if (endpoints.length === 0) {
    println('\tNone')
  }
}
@@ -131,23 +131,22 @@
 utes = (
-println
+output
 , tokens
@@ -182,23 +182,26 @@
 rray%0A%0A  
-println
+output.log
 ('Availa
@@ -218,16 +218,27 @@
 ints')%0A 
+ let rows =
  endpoin
@@ -244,15 +244,11 @@
 nts.
-forEach
+map
 ((en
@@ -260,16 +260,17 @@
 t) =%3E %7B%0A
+%0A
     let 
@@ -315,191 +315,74 @@
 let 
-line = '%5Ct' + method + '%5Ct' + endpoint.path%0A    if (endpoint.directory) %7B%0A      line += '/*'%0A    %7D%0A    if (endpoint.description) %7B%0A      line += '%5Ct' + endpoint.description%0A    %7D else
+path = endpoint.path%0A    let desc = endpoint.description %7C%7C ''%0A   
  if 
@@ -414,25 +414,20 @@
     
-line
+path
  += '
-static' 
+/*'
 %0A   
@@ -470,17 +470,22 @@
     
-line += '
+desc = 'static
  - '
@@ -521,21 +521,35 @@
     
-println(line)
+return %5Bmethod, path, desc%5D
 %0A  %7D
@@ -590,24 +590,65 @@
     
-println('%5CtNone'
+output.log('%5CtNone')%0A  %7D else %7B%0A    output.table(%7B%7D, rows
 )%0A  

Change console to use cli-table format.