[ 
https://issues.apache.org/jira/browse/CB-6481?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14097576#comment-14097576
 ] 

ASF GitHub Bot commented on CB-6481:
------------------------------------

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



> Add unified hooks support for cordova app and plugins
> -----------------------------------------------------
>
>                 Key: CB-6481
>                 URL: https://issues.apache.org/jira/browse/CB-6481
>             Project: Apache Cordova
>          Issue Type: New Feature
>          Components: CLI, Plugman
>            Reporter: Sergey Grebnov
>            Assignee: Sergey Grebnov
>
> As per "Proposal: hooks support for plugins" dev mail thread discussion
> Hi, I have an idea how we can add more flexibility to plugin developers.
> Note, right now we have Application Developers – someone who use Cordova for 
> developing applications and Plugin Developers – someone who creates plugins 
> so that Application Developers can use them. For Application Developers we 
> expose  hooks so that they can customize their build/package/etc process. I 
> want us to provide similar sort of flexibility to Plugin Developers so that 
> they can go beyond of <source/>, <framework/>  tags and get mechanism to add 
> custom installation,  build logic required by a plugin. Example usage will 
> include: downloading/compiling additional binaries, marking source file to be 
> copied to output dir, changing target build platform,  etc. At present time 
> the steps described could be only achieved by hooks manually added by 
> Application Developer, but the right way is to allow Plugin Developer to 
> expose this as part of plugin definition.
> Example configuration could look like
> ```
> <script type="postinstall" src="scripts/postinstall.js" />
> <script type="preinstall" src="scripts/preinstall.js" />
> <script type="install" src="scripts/install.js" />
> ```
> beforeinstall/preinstall – run before plugin is installed
> install/postinstall/afterinstall – run after plugin is installed
> uninstall – run after plugin is uninstalled



--
This message was sent by Atlassian JIRA
(v6.2#6252)

Reply via email to