-
Notifications
You must be signed in to change notification settings - Fork 1
/
cli.py
34 lines (27 loc) · 777 Bytes
/
cli.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/env python3
import click
import os
@click.group()
def main():
pass
@main.command()
@click.option('--msg', prompt="Commit message", required=True, type=str)
def push(msg):
curDir = os.getcwd()
files = os.listdir(curDir)
if '.git' in files:
print('already exists')
os.system('git init')
os.system('git add .')
os.system(f'git commit -m "{msg}"')
os.system('git push origin master')
else:
origin = input('Type github remote origin: ')
print(origin)
os.system('git init')
os.system('git add .')
os.system(f'git commit -m "{msg}"')
os.system(f'git remote add origin {origin}')
os.system('git push origin master')
if __name__=="__main__":
main()