var
  utilities = require('fedtools-utilities'),
  log = require('fedtools-logs'),
  common = require('../../common'),
  DEFAULT_PORT = 9999,

  MAPPING = {
    'auto': 'commands',
    'manual': 'commands',
    'extra': 'commands',
    'lite': 'commands',

    'custom': 'customization',
    'customization': 'customization',
    'prompt': 'customization',

    'sinopia': 'sinopia',

    'history': 'history',

    'alias': 'aliases',
    'aliases': 'aliases'
  };

module.exports = function (self, type) {
  var
    tab,
    msg = [];
  log.info('Starting helper server... CTRL+C to stop it');
  utilities.simpleserver.listen({
    quiet: true,
    port: DEFAULT_PORT,
    root: common.ENVTOOLS.ROOTDIR
  }, function (err, data) {
    if (err) {
      throw (err);
    }
    if (data && data.url) {
      if (type) {
        tab = MAPPING[type];
      }
      msg.push('');
      msg.push('Envtools help is now available here: ');
      msg.push(log.strToColor('cyan', data.url));
      msg.push('');
      log.printMessagesInBox(msg);
      if (tab) {
        data.url = data.url + '?' + tab;
      }
      utilities.openInBrowser({
        confirm: false,
        url: data.url
      });
    }
  });
  process.on('SIGINT', function () {
    log.echo('\nEnvtools help server is being terminated...');
    process.exit();
  });

  process.on('SIGTERM', function () {
    log.echo('\nEnvtools help server is being terminated...');
    process.exit();
  });
};

@@ -1,12 +1,37 @@
 var%0A
+  _ = require('lodash'),%0A
   utilit
@@ -163,16 +163,20 @@
 999,%0A%0A  
+TAB_
 MAPPING 
@@ -181,96 +181,180 @@
 G = 
+%5B
 %7B%0A    '
-auto': 'commands',%0A    'manual': 'commands',%0A    'extra': 'commands',%0A    '
+tab': 'introduction',%0A    'keywords': %5B'intro', 'introduction', 'help'%5D%0A  %7D, %7B%0A    'tab': 'commands',%0A    'keywords': %5B'auto', 'manual', 'extra', 'lite', 'env
 lite'
-:
+,
  'co
@@ -364,124 +364,199 @@
 nds'
-,%0A%0A    'custom': 'customization',%0A    'customization': 'customization',%0A    'prompt': 'customization',%0A%0A    'sinopia
+%5D%0A  %7D, %7B%0A    'tab': 'aliases',%0A    'keywords': %5B'alias', 'aliases', 'web', 'ls', 'll'%5D%0A  %7D, %7B%0A    'tab': 'customization',%0A    'keywords': %5B'custom', 'customization', 'prompt'%5D%0A  %7D, %7B%0A    'tab
 ': '
@@ -569,88 +569,104 @@
 a',%0A
-%0A
     '
-history': 'history',%0A%0A    'alias': 'aliases',%0A    'aliases': 'aliases'
+keywords': %5B'sinopia', 'npm'%5D%0A  %7D, %7B%0A    'tab': 'history',%0A    'keywords': %5B'history'%5D
 %0A  %7D
+%5D
 ;%0A%0Am
@@ -718,16 +718,21 @@
 %0A    tab
+ = ''
 ,%0A    ms
@@ -743,67 +743,8 @@
 %5B%5D;%0A
-  log.info('Starting helper server... CTRL+C to stop it');%0A
   ut
@@ -980,50 +980,197 @@
 b = 
-MAPPING%5Btype%5D;%0A      %7D%0A      msg.push('');
+_.filter(TAB_MAPPING, function (o) %7B%0A          if (_.indexOf(o.keywords, type) %3E= 0) %7B%0A            return true;%0A          %7D else %7B%0A            return false;%0A          %7D%0A        %7D);%0A      %7D%0A
 %0A   
@@ -1191,21 +1191,90 @@
 nvtools 
-h
+H
 elp 
+Server is up and running.');%0A      msg.push('');%0A      msg.push('URL 
 is now a
@@ -1358,24 +1358,74 @@
 g.push('');%0A
+      msg.push('Hit CTRL-C to stop the server.');%0A
       log.pr
@@ -1460,16 +1460,44 @@
  if (tab
+ && tab.length && tab%5B0%5D.tab
 ) %7B%0A    
@@ -1528,16 +1528,23 @@
 + '?' + 
+tab%5B0%5D.
 tab;%0A   
@@ -1702,38 +1702,38 @@
 cho('%5CnEnvtools 
-h
+H
 elp 
-s
+S
 erver is being t
@@ -1842,14 +1842,14 @@
 ols 
-h
+H
 elp 
-s
+S
 erve

add targeting help tab