code: function parseCommandLine(args) {
  
      var parsed_cmds = [];
  
      if (args.length <= 2) {
          parsed_cmds.push(defaultCommand());
      } else {
  
          var cli = args.slice(2);
  
          var pos = 0;
          var cmd;
  
          cli.forEach(function(element, index, array) {
  
              //replace alias name with real name.
              if (element.indexOf('--') === -1 && element.indexOf('-') === 0) {
                  cli[index] = alias_map[element];
              }
  
              //parse command and args
              if (cli[index].indexOf('--') === -1) {
                  cmd.args.push(cli[index]);
              } else {
  
                  if (keys[cli[index]] == "undefined") {
                      throw new Error("not support command:" + cli[index]);
                  };
  
                  pos = index;
                  cmd = commands[cli[index]];
                  if (typeof cmd.args == 'undefined') {
                      cmd.args = [];
                  };
                  parsed_cmds.push(cmd);
              }
          });
      };
  
      return parsed_cmds;
  }
docs: parse command line args