Skip to content
Permalink
Branch: master
Find file Copy path
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
executable file 40 lines (34 sloc) 1.11 KB
#!/usr/bin/env python
from argparse import ArgumentParser
import os
import subprocess
BLACK = '\033[30m'
RED = '\033[31m'
GREEN = '\033[32m'
YELLOW = '\033[33m'
BLUE = '\033[34m'
PURPLE = '\033[35m'
CYAN = '\033[36m'
WHITE = '\033[37m'
END = '\033[0m'
BOLD = '\038[1m'
UNDERLINE = '\033[4m'
INVISIBLE = '\033[08m'
REVERCE = '\033[07m'
def parser():
usage = 'Usage: git exec <command_name> [...argv]'
argparser = ArgumentParser(usage=usage)
argparser.add_argument('command_name', help='Execute command', nargs="*")
command = " ".join(argparser.parse_args().command_name)
print("{0}Execute: {1}{2}".format(GREEN, command, END))
result = subprocess.call(command, shell=True)
if(result == 1):
return
msg = "Exec `{}`".format(command, shell=True)
print("{0}Add staging files{1}".format(GREEN, END))
subprocess.call("git add .", shell=True)
print("{0}Commit: {1}{2}".format(GREEN, msg, END))
print("git commit -m '{}'".format(msg))
subprocess.call("git commit -m '{}'".format(msg), shell=True)
if __name__ == '__main__':
parser()
You can’t perform that action at this time.