Skip to content

Commit

Permalink
plugins/**: Add help string for re_botcmds
Browse files Browse the repository at this point in the history
Closes #230
  • Loading branch information
meetmangukiya committed Aug 24, 2017
1 parent f64b761 commit 809c97f
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 10 deletions.
10 changes: 7 additions & 3 deletions plugins/coatils.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,8 @@ def all_langs():

return set(all_langs)

@re_botcmd(pattern=r'(?:(contrib|bear|lang)\s+)?stats(.+)?(?:(?:\s+)|$)')
@re_botcmd(pattern=r'(?:(contrib|bear|lang)\s+)?stats(.+)?(?:(?:\s+)|$)',
re_cmd_name_help='(contrib|bear|lang) stats [username|language]')
def contrib_stats(self, msg, match):
"""
Allowed commands:
Expand Down Expand Up @@ -101,7 +102,8 @@ def contrib_stats(self, msg, match):
''.format(Coatils.total_bears(),
len(Coatils.all_langs())))

@re_botcmd(pattern=r'ls\s+bears\s+((?:[\w\+]+(?:\s+)?)+)')
@re_botcmd(pattern=r'ls\s+bears\s+((?:[\w\+]+(?:\s+)?)+)',
re_cmd_name_help='ls bears [langs]+')
def ls(self, msg, match):
"""
List bears of given languages:
Expand Down Expand Up @@ -163,7 +165,9 @@ def position(stl, stc, enl, enc):
enl, enc)

# Ignore PycodestyleBear, LineLengthBear
@re_botcmd(pattern=r'^run\s+(\w+)((?:\s+\w+(?:\s+\w+=\w+)*)+)\n+```\n([\s\S]+)\n```$')
@re_botcmd(pattern=r'^run\s+(\w+)((?:\s+\w+(?:\s+\w+=\w+)*)+)\n+```\n([\s\S]+)\n```$',
re_cmd_name_help='run <Bear [[setting=value]+]>+\n'
'```\n<code>+\n```')
def run(self, msg, match):
"""
Run coala over the given code.
Expand Down
5 changes: 3 additions & 2 deletions plugins/explain.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,8 +90,9 @@ class Explain(BotPlugin):
'\n- '.join(MSGS.keys())
)

# Ignore LineLengthBear, PycodestyleBear
@re_botcmd(pattern=r'explain\s+(\w+)(?:\s+to\s+@?([\w-]+))?', flags=re.IGNORECASE)
@re_botcmd(pattern=r'explain\s+(\w+)(?:\s+to\s+@?([\w-]+))?',
re_cmd_name_help='explain <term>',
flags=re.IGNORECASE)
def explain(self, msg, match):
"""Explain various terms.""" # Ignore QuotesBear
return ('{}'.format('@{}: \n'.format(match.group(2))
Expand Down
4 changes: 3 additions & 1 deletion plugins/ghetto.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,9 @@ class Ghetto(BotPlugin):
Real talk yo
"""

@re_botcmd(pattern=r'ghetto\s+(.+)', flags=re.IGNORECASE)
@re_botcmd(pattern=r'ghetto\s+(.+)',
re_cmd_name_help='ghetto <sentence>',
flags=re.IGNORECASE)
def ghetto(self, msg, match):
"""
Real talk yo
Expand Down
7 changes: 6 additions & 1 deletion plugins/labhub.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,8 @@ def TEAMS(self, new):
self._teams = new

# Ignore LineLengthBear, PycodestyleBear
@re_botcmd(pattern=r'(?:(?:invite)|(?:inv))\s+@?([\w-]+)(?:\s*(?:to)\s+(\w+))?')
@re_botcmd(pattern=r'(?:(?:invite)|(?:inv))\s+@?([\w-]+)(?:\s*(?:to)\s+(\w+))?',
re_cmd_name_help='invite [to team]')
def invite_cmd(self, msg, match):
"""
Invite given user to given team. By default it invites to
Expand Down Expand Up @@ -136,6 +137,7 @@ def callback_message(self, msg):
self.invited_users.add(user)

@re_botcmd(pattern=r'(?:new|file) issue ([\w-]+?)(?: |\n)(.+?)(?:$|\n((?:.|\n)*))', # Ignore LineLengthBear, PyCodeStyleBear
re_cmd_name_help='new issue repo-name title\n[description]',
flags=re.IGNORECASE)
def create_issut_cmd(self, msg, match):
"""Create issues on GitHub and GitLab repositories.""" # Ignore QuotesBear, LineLengthBear, PyCodeStyleBear
Expand Down Expand Up @@ -164,6 +166,7 @@ def create_issut_cmd(self, msg, match):
'and owned by the org.')

@re_botcmd(pattern=r'^unassign\s+https://(github|gitlab)\.com/([^/]+)/([^/]+)/issues/(\d+)', # Ignore LineLengthBear, PyCodeStyleBear
re_cmd_name_help='unassign <complete-issue-URL>',
flags=re.IGNORECASE)
def unassign_cmd(self, msg, match):
"""Unassign from an issue.""" # Ignore QuotesBear
Expand All @@ -190,6 +193,7 @@ def unassign_cmd(self, msg, match):
return 'You are not an assignee on the issue.'

@re_botcmd(pattern=r'mark\s+(wip|pending)\s+https://(github|gitlab)\.com/([^/]+)/([^/]+)/(pull|merge_requests)/(\d+)', # Ignore LineLengthBear, PyCodeStyleBear
re_cmd_name_help='mark (wip|pending) <complete-PR-URL>',
flags=re.IGNORECASE)
def mark_cmd(self, msg, match):
"""Mark a given PR/MR with status labels.""" # Ignore QuotesBear
Expand Down Expand Up @@ -237,6 +241,7 @@ def mark_cmd(self, msg, match):
)

@re_botcmd(pattern=r'^assign\s+https://(github|gitlab)\.com/([^/]+)/([^/]+/)+issues/(\d+)', # Ignore LineLengthBear, PyCodeStyleBear
re_cmd_name_help='assign <complete-issue-URL>',
flags=re.IGNORECASE)
def assign_cmd(self, msg, match):
"""Assign to GitLab and GitHub issues.""" # Ignore QuotesBear
Expand Down
3 changes: 2 additions & 1 deletion plugins/lmgtfy.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ class Lmgtfy(BotPlugin):
'help you even faster!'
)

@re_botcmd(pattern=r'lmgtfy\s+(.+)')
@re_botcmd(pattern=r'lmgtfy\s+(.+)',
re_cmd_name_help='lmgtfy <search-string>')
def lmgtfy(self, msg, match):
"""I'm lazy, please google for me.""" # Ignore QuotesBear
link = 'https://www.lmgtfy.com/?q=' + match.group(1)
Expand Down
4 changes: 3 additions & 1 deletion plugins/ship_it.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ class Ship_it(BotPlugin):
]
# stop ignoring LineLengthBear PyCodeStyleBear

@re_botcmd(pattern=r'ship\s*it', flags=re.IGNORECASE)
@re_botcmd(pattern=r'ship\s*it',
re_cmd_name_help='ship it',
flags=re.IGNORECASE)
def ship_it(self, msg, match):
"""
Show motivational ship it squirrel images.
Expand Down
4 changes: 3 additions & 1 deletion plugins/the_rules.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,9 @@ class The_rules(BotPlugin):
'does not conflict with the First or Second Law.'
]

@re_botcmd(pattern=r'the\s+rules', flags=re.IGNORECASE)
@re_botcmd(pattern=r'the\s+rules',
re_cmd_name_help='the rules',
flags=re.IGNORECASE)
def the_rules(self, msg, args):
"""
Show the bot rules.
Expand Down

0 comments on commit 809c97f

Please sign in to comment.