Uploaded image for project: 'TinkerPop'
  1. TinkerPop
  2. TINKERPOP-1653

Allow multiple scripts with arguments to be passed to the Console

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.2.4
    • Fix Version/s: 3.2.5
    • Component/s: console
    • Labels:
      None

      Description

      Gremlin Console currently supports -e and -i for passing in scripts to execute from the command line, but it is only possible to pass one script with either command. It would be helpful to allow multiple scripts with associated arguments for each as it would provide greater flexibility when doing automation through the console.

      bin/gremlin.sh -i scripts/x.groovy -i scripts/y.groovy 123 test -D -i "scripts/z.groovy -D -i -e"
      

        Issue Links

          Activity

          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user asfgit closed the pull request at:

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

          Show
          githubbot ASF GitHub Bot added a comment - Github user asfgit closed the pull request at: https://github.com/apache/tinkerpop/pull/576
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user spmallette commented on the issue:

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

          I think I got good stuff for you @robertdale - please have a look.

          Show
          githubbot ASF GitHub Bot added a comment - Github user spmallette commented on the issue: https://github.com/apache/tinkerpop/pull/576 I think I got good stuff for you @robertdale - please have a look.
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user robertdale commented on the issue:

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

          might want to add these scripts/test to `validate-distribution.sh`

          Show
          githubbot ASF GitHub Bot added a comment - Github user robertdale commented on the issue: https://github.com/apache/tinkerpop/pull/576 might want to add these scripts/test to `validate-distribution.sh`
          Hide
          githubbot ASF GitHub Bot added a comment -

          Github user twilmes commented on the issue:

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

          I experimented with variations of arguments and all looked good.

          VOTE: +1

          Show
          githubbot ASF GitHub Bot added a comment - Github user twilmes commented on the issue: https://github.com/apache/tinkerpop/pull/576 I experimented with variations of arguments and all looked good. VOTE: +1
          Hide
          githubbot ASF GitHub Bot added a comment -

          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 <spmva@genoprime.com>
          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.


          Show
          githubbot ASF GitHub Bot added a comment - 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 <spmva@genoprime.com> 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.

            People

            • Assignee:
              spmallette stephen mallette
              Reporter:
              spmallette stephen mallette
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development