Skip to content

Commit 6c2f3b2

Browse files
committed
fix
1 parent c29c724 commit 6c2f3b2

File tree

2 files changed

+35
-13
lines changed

2 files changed

+35
-13
lines changed

.last_tmp.py

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
import os
2+
import argparse
3+
4+
from git import Repo
5+
6+
repo = Repo(".")
7+
8+
def gaddc(message):
9+
git = repo.git
10+
git.add(".")
11+
git.commit("-m", message)
12+
13+
def parser_gp():
14+
parser = argparse.ArgumentParser(description="combination and simplification of some useful git commands")
15+
subparser = parser.add_subparsers(help="commands")
16+
17+
addc = subparser.add_parser("addc", help="add and commit")
18+
addc.add_argument("-m", "--message", help="commit message", required=True)
19+
20+
args = parser.parse_args()
21+
print(args)
22+
if "message" in args:
23+
gaddc(args.message)
24+
25+
if __name__ == "__main__":
26+
parser_gp()

main.py

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,28 +3,24 @@
33

44
from git import Repo
55

6-
class GitPython:
7-
def __init__(self):
8-
self.repo = Repo(".")
6+
repo = Repo(".")
97

10-
def add_and_commit(self, message):
11-
repo = self.repo
12-
git = repo.git
13-
git.add("*")
14-
git.commit("-m", message)
15-
16-
gitpython = GitPython()
8+
def gaddc(message):
9+
git = repo.git
10+
git.add(".")
11+
git.commit("-m", message)
1712

1813
def parser_gp():
1914
parser = argparse.ArgumentParser(description="combination and simplification of some useful git commands")
2015
subparser = parser.add_subparsers(help="commands")
2116

2217
addc = subparser.add_parser("addc", help="add and commit")
23-
addc.add_argument("-m", help="commit message", required=True)
18+
addc.add_argument("-m", "--message", help="commit message", required=True)
2419

2520
args = parser.parse_args()
26-
if "m" in args:
27-
gitpython.add_and_commit(args.m)
21+
print(args)
22+
if "message" in args:
23+
gaddc(args.message)
2824

2925
if __name__ == "__main__":
3026
parser_gp()

0 commit comments

Comments
 (0)