-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgiggity.py
More file actions
executable file
·34 lines (23 loc) · 1.16 KB
/
Copy pathgiggity.py
File metadata and controls
executable file
·34 lines (23 loc) · 1.16 KB
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 # path to python3 interpreter
# This is the main file (entry point of the program)
# local modules arguments.py, procelain.py, plumbing.py and misc.py
import arguments, porcelain, plumbing
from misc import os
def main():
args = arguments.parse_arguments()
# repository check: only allow `init` and `clone` if there's no .giggity directory
if args.func.__name__ not in ("init", "clone"):
if not os.path.isdir(os.path.join(os.getcwd(), ".giggity")):
print("fatal: not a giggity repository\ninitialize the repo first using giggity init [dir]")
exit(1)
args.func(args)
def init(args): porcelain.init(args.directory)
def clone(args): porcelain.clone(args.branch, args.link, args.directory)
def hash_object(args):
if (args.write): plumbing.hash_object(args.file, write=True)
else: plumbing.hash_object(args.file)
def cat_file(args):
if (args.printing): print(plumbing.cat_file(args.object, printing=True))
elif (args.size): print(plumbing.cat_file(args.object, size=True))
elif (args.type): print(plumbing.cat_file(args.object, type=True))
if __name__ == "__main__": main()