Explorar el Código

color kinda makes quotes redundant...

tags/v0.1
Ben Kurtovic hace 13 años
padre
commit
dbafb29e4d
Se han modificado 1 ficheros con 6 adiciones y 6 borrados
  1. +6
    -6
      actions.py

+ 6
- 6
actions.py Ver fichero

@@ -52,7 +52,7 @@ def cmd_git(nick, host, chan, msg): # commands to interface with the bot's git r
elif args[0] == "branch": # get our current branch elif args[0] == "branch": # get our current branch
branch = subprocess.check_output(['git', 'name-rev', '--name-only', 'HEAD'], stderr=subprocess.STDOUT) # git name-rev --name-only HEAD branch = subprocess.check_output(['git', 'name-rev', '--name-only', 'HEAD'], stderr=subprocess.STDOUT) # git name-rev --name-only HEAD
branch = branch[:-1] # strip newline branch = branch[:-1] # strip newline
say(chan, "\x02%s\x0F: currently on branch '\x0302%s\x0301'." % (nick, branch))
say(chan, "\x02%s\x0F: currently on branch \x0302%s\x0301." % (nick, branch))


elif args[0] == "branches": # get list of branches elif args[0] == "branches": # get list of branches
branches = subprocess.check_output(['git', 'branch'], stderr=subprocess.STDOUT) # git branch branches = subprocess.check_output(['git', 'branch'], stderr=subprocess.STDOUT) # git branch
@@ -72,16 +72,16 @@ def cmd_git(nick, host, chan, msg): # commands to interface with the bot's git r
try: try:
result = subprocess.check_output(['git', 'checkout', branch], stderr=subprocess.STDOUT) # git checkout our_branch result = subprocess.check_output(['git', 'checkout', branch], stderr=subprocess.STDOUT) # git checkout our_branch
if "Already on" in result: if "Already on" in result:
say(chan, "\x02%s\x0F: already on '\x0302%s\x0301'!" % (nick, branch))
say(chan, "\x02%s\x0F: already on \x0302%s\x0301!" % (nick, branch))
else: else:
say(chan, "\x02%s\x0F: switched to branch '\x0302%s\x0301'." % (nick, branch))
say(chan, "\x02%s\x0F: switched to branch \x0302%s\x0301." % (nick, branch))
except subprocess.CalledProcessError: # git couldn't switch branches except subprocess.CalledProcessError: # git couldn't switch branches
say(chan, "\x02%s\x0F: branch '\x0302%s\x0301' does not exist!" % (nick, branch))
say(chan, "\x02%s\x0F: branch \x0302%s\x0301 does not exist!" % (nick, branch))


elif args[0] == "pull": # pull from remote repository elif args[0] == "pull": # pull from remote repository
branch = subprocess.check_output(['git', 'name-rev', '--name-only', 'HEAD'], stderr=subprocess.STDOUT) # git name-rev --name-only HEAD branch = subprocess.check_output(['git', 'name-rev', '--name-only', 'HEAD'], stderr=subprocess.STDOUT) # git name-rev --name-only HEAD
branch = branch[:-1] # strip newline branch = branch[:-1] # strip newline
say(chan, "\x02%s\x0F: pulling from remote (currently on '\x0302%s\x0301')..." % (nick, branch))
say(chan, "\x02%s\x0F: pulling from remote (currently on \x0302%s\x0301)..." % (nick, branch))
result = subprocess.check_output(['git', 'pull']) # pull from remote result = subprocess.check_output(['git', 'pull']) # pull from remote
if "Already up-to-date." in result: if "Already up-to-date." in result:
say(chan, "\x02%s\x0F: done; no new changes." % nick) say(chan, "\x02%s\x0F: done; no new changes." % nick)
@@ -89,4 +89,4 @@ def cmd_git(nick, host, chan, msg): # commands to interface with the bot's git r
say(chan, "\x02%s\x0F: done; new changes merged." % nick) say(chan, "\x02%s\x0F: done; new changes merged." % nick)


else: else:
say(chan, "\x02%s\x0F: unknown argument: '\x0303%s\x0301'." % (nick, args[0]))
say(chan, "\x02%s\x0F: unknown argument: \x0303%s\x0301." % (nick, args[0]))

Cargando…
Cancelar
Guardar