cordova-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From csantanapr <...@git.apache.org>
Subject [GitHub] cordova-lib pull request: CB-6481 Add unified hooks support for co...
Date Thu, 14 Aug 2014 20:21:33 GMT
Github user csantanapr commented on the pull request:

    https://github.com/apache/cordova-lib/pull/55#issuecomment-52238594
  
    @sgrebnov here some feedback about context.cmdLine
    
    Any strong reason why this has to be a string instead of an Array like process.argv ?
    
    https://github.com/MSOpenTech/cordova-lib/blob/CB-6481-hooks/cordova-lib/src/hooks/Context.js#L44
    
        this.cmdLine =  process.argv.join(' ');
    
    I want to parse but I don't feel comfortable doing a split(' ') on spaces because the
parameter I'm looking for is a path and path can have spaces specially in Windows :-)
    
    Can we make context.cmdLine be process.argv and not a String or add a context.cmdArgv
to Context Class.
    
    This is what I have and don't like the idea of converting to Array with split on spaces
    
    ````
    var cmdLine = context.cmdLine.split(' ').filter(function(item){
        return item !== '--';
      });
      var knowOpts = {'wlpath': path};
      var shortHands = {'wl' : '--wlpath'};
      var parsedCmdLine = nopt(knowOpts, shortHands, cmdLine, 0);
    
      console.log(parsedCmdLine);
      if(parsedCmdLine.wlpath){
        console.log('Updating Worklight App path to;'+parsedCmdLine.wlpath);
        wlappPath = parsedCmdLine.wlpath;
      }
    ````
    Oh one thing weird about using nopt is if  dash dash <space> '-- ' is present nopt
doesn't parse correctly, that's why I'm using a filter 
    
    Let me know what you think



---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at infrastructure@apache.org or file a JIRA ticket
with INFRA.
---

Mime
View raw message