 #   "xml2js": "^0.4.1"
 #
 # Commands:
-#   hubot rundeck list projects in [environment]                     - Gets a list of the projects for the given server alias
-#   hubut rundeck list jobs in [project] in [environment]            - Gets a list of all the jobs in the given project for the given server alias
-#   hubot rundeck run [job] in [project] on [environment]            - Triggers the given job for the given project
-#   hubot rundeck show status of [job] in [project] on [environment] - Shows the current status for the latest execution of the given job
+#   hubot rundeck projects [alias]                                   - Gets a list of the projects for the given server alias
+#   hubut rundeck jobs '[project]' [alias]                           - Gets a list of all the jobs in the given project for the given server alias
+#   hubot rundeck trigger '[job]' '[project]' [alias] [args]         - Triggers the given job for the given project
+#   hubot rundeck status '[job]' '[project]' [alias]                 - Shows the current status for the latest execution of the given job
 #   hubot rundeck show aliases                                       - shows the aliases for the list of rundeck instances
 #   hubot rundeck add alias [alias name] [url] [authToken]           - sets the alias for a given url and authentication token
 #   hubot rundeck clear alias [alias name]                           - removed the given alias

    robot.brain.data.rundeck_aliases = _rundeckAliases
    msg.send("The rundeck system alias #{alias} for #{url} has been added to the brain")



  robot.respond /rundeck list projects in (.*)/i, (msg) ->
    if msg.message.user.id is robot.name
      return


        else
          msg.send "No jobs found for rundeck #{project}"

  #hubot rundeck trigger 'my-job' 'MyProject' myrundeck-alias args:<optional args>
  robot.respond /rundeck trigger '(.*)'\s'(.*)'\s([\w]+)(?: args:)?(.*)/i, (msg) ->
    if msg.message.user.id is robot.name
      return

    name = msg.match[1]
    project = msg.match[2]
    args = msg.match[4]

    alias =  msg.match[3]
    url = _rundeckAliases[alias]['url']
