Spike optional doc: key for command

This isn't working yet.
This commit is contained in:
John Barnette
2013-03-13 19:40:35 -07:00
parent 2b35eaa414
commit 460577d9ae
2 changed files with 32 additions and 9 deletions

View File

@@ -52,10 +52,14 @@ _.mixin
regex = RegExp('[' + specials.join('\\') + ']', 'g')
string.replace(regex, "\\$&");
humanizeEventName: (eventName) ->
humanizeEventName: (eventName, optionalDocString) ->
return "GitHub" if eventName.toLowerCase() is "github"
if /:/.test(eventName)
[namespace, name] = eventName.split(':')
return "#{@humanizeEventName(namespace)}: #{@humanizeEventName(name)}"
return "#{@humanizeEventName(namespace)}: #{@humanizeEventName(name, optionalDocString)}"
return optionalDocString if not _.isEmpty(optionalDocString)
words = eventName.split('-')
words.map(_.capitalize).join(' ')