GitHub user spmallette opened a pull request:

    https://github.com/apache/tinkerpop/pull/576

    TINKERPOP-1653 Allow multiple scripts to be passed to gremlin.sh

    https://issues.apache.org/jira/browse/TINKERPOP-1653
    
    This is a non-breaking change and simply allows multiple `-i` and `-e` 
options on gremlin.sh. The old method for passing a single script name to 
gremlin.sh remains intact as well. Had to write a custom parser for the command 
line arguments to do this because it doesn't appear that `CliBuilder` is 
capable of parsing the in the manner necessary to support this feature 
unfortunately.
    
    Here's some example usage given these three scripts:
    
    ```text
    $ more *.groovy
    ::::::::::::::
    x.groovy
    ::::::::::::::
    x = 1 + 1
    ::::::::::::::
    y.groovy
    ::::::::::::::
    y = args.collect{Integer.parseInt(it)}.sum()
    ::::::::::::::
    z.groovy
    ::::::::::::::
    z = "argument=" + args
    ```
    
    This is old, now deprecated, method that is still supported:
    
    ```
    $ bin/gremlin.sh x.groovy 
    
             \,,,/
             (o o)
    -----oOOo-(3)-oOOo-----
    plugin activated: tinkerpop.server
    plugin activated: tinkerpop.utilities
    plugin activated: tinkerpop.tinkergraph
    gremlin> x
    ==>2
    ```
    
    Next with `-i` as usual:
    
    ```text
    $ bin/gremlin.sh -i x.groovy
    
             \,,,/
             (o o)
    -----oOOo-(3)-oOOo-----
    plugin activated: tinkerpop.server
    plugin activated: tinkerpop.utilities
    plugin activated: tinkerpop.tinkergraph
    gremlin> x
    ==>2
    ```
    
    then with arguments:
    
    ```text
    $ bin/gremlin.sh -i y.groovy 1 2 3
    
             \,,,/
             (o o)
    -----oOOo-(3)-oOOo-----
    plugin activated: tinkerpop.server
    plugin activated: tinkerpop.utilities
    plugin activated: tinkerpop.tinkergraph
    gremlin> y
    ==>6
    ```
    
    Next with multiple scripts:
    
    ```text
    $ bin/gremlin.sh -i y.groovy 1 2 3 -i x.groovy
    
             \,,,/
             (o o)
    -----oOOo-(3)-oOOo-----
    plugin activated: tinkerpop.server
    plugin activated: tinkerpop.utilities
    plugin activated: tinkerpop.tinkergraph
    gremlin> y
    ==>6
    gremlin> x
    ==>2
    ```
    
    Then with multiple scripts with other `gremlin.sh` options mixed in
    
    ```text
    $ bin/gremlin.sh -i y.groovy 1 2 3 --color -i x.groovy -i "z.groovy x -i 
--color -D"
    
             \,,,/
             (o o)
    -----oOOo-(3)-oOOo-----
    plugin activated: tinkerpop.server
    plugin activated: tinkerpop.utilities
    plugin activated: tinkerpop.tinkergraph
    gremlin> x
    ==>2
    gremlin> y
    ==>6
    gremlin> z
    ==>argument=[x, -i, --color, -D]
    ```
    
    Finally, note that you still can't mix/match `-i` and `-e` commands - 
`CliBuilder` still rejects bad stuff like that:
    
    ```text
    $ bin/gremlin.sh -i y.groovy 1 2 3 --color -i x.groovy -e "z.groovy x -i 
--color -D"
    -i and -e options are mutually exclusive - provide one or the other
    ```
    
    VOTE +1

You can merge this pull request into a Git repository by running:

    $ git pull https://github.com/apache/tinkerpop TINKERPOP-1653

Alternatively you can review and apply these changes as the patch at:

    https://github.com/apache/tinkerpop/pull/576.patch

To close this pull request, make a commit to your master/trunk branch
with (at least) the following in the commit message:

    This closes #576
    
----
commit 1503311f030291745276805188e61b525576d604
Author: Stephen Mallette <[email protected]>
Date:   2017-03-17T14:23:34Z

    TINKERPOP-1653 Allow multiple scripts to be passed to gremlin.sh
    
    This is a non-breaking change and simply allows multiple -i and -e options 
on gremlin.sh. The old method for passing a single script name to gremlin.sh 
remains intact as well. Had to write a custom parser for the command line 
arguments to do this because it doesn't appear that CliBuilder is capable of 
parsing the in the manner necessary to support this feature unfortunately.

----


---
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 [email protected] or file a JIRA ticket
with INFRA.
---

Reply via email to