Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
43 lines (37 sloc) 1.001 kb
# Description:
# Show some help to git noobies
#
# Dependencies:
# jsdom
# jquery
#
# Configuration:
# None
#
# Commands:
# git help <topic>
#
# Author:
# vquaiato, Jens Jahnke
jsdom = require("jsdom").jsdom
module.exports = (robot) ->
robot.respond /git help (.+)$/i, (msg) ->
topic = msg.match[1].toLowerCase()
url = 'http://git-scm.com/docs/git-' + topic
msg.http(url).get() (err, res, body) ->
window = (jsdom body, null,
features:
FetchExternalResources: false
ProcessExternalResources: false
MutationEvents: false
QuerySelector: false
).createWindow()
$ = require("jquery").create(window)
name = $.trim $('#header .sectionbody .paragraph').text()
desc = $.trim $('#_synopsis + .verseblock > .content').text()
if name and desc
msg.send name
msg.send desc
msg.send "See #{url} for details."
else
msg.send "No git help page found for #{topic}."
Jump to Line
Something went wrong with that request. Please try again.