MovingBlocks

Groovy: Add remote setting functionality to "get" command

Earlier this year, we developed a Groovy wrapper for adding nice utility commands in Groovy

Your task is to extend the groovyw module get command to allow users to add specific git remotes in addition to just the default "origin". You should extend the module get command in the following way:

  • groovyw module get MyModule clones "github.com/Terasology/MyModule.git" (unchanged from the current default behavior)
  • groovyw module get MyUser/MyModule clones Terasology/MyModule and adds a git remote called "MyUser" that points to "MyUser/Module" (scan for the / to detect this scenario)
  • groovyw module get Module1 Module2 Module3 -remote MyUser clones Terasology/Module1 2 and 3 and adds remotes called "MyUser" which points to "github.com/MyUser/Module1" 2 and 3

Examples:

  • groovyw module get MyUser/Sample clones Terasology/Sample and adds a git remote called "MyUser" that points to "MyUser/Sample"
  • groovyw module get Sample CakeLie -remote MyUser clones Terasology/Sample and Terasology/CakeLie and adds a remote for each called MyUser pointing to the repos under https://github.com/MyUser

Definition of "Done"

  • You have created a PR to the Terasology repo that adds the required functionality.
  • Bonus: Also enable user input if you want to type in the remote (groovyw module get Sample -remote would act like groovyw module get and ask the user for the parameter)

Where to start

  • Take a look at other Groovy commands in the module.groovy file to get a feel for how Groovy works.

Task tags

  • groovy
  • scripting
  • utility

Students who completed this task

Arpit Kamboj

Task type

  • code Code
close

2017