-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlist
executable file
·38 lines (34 loc) · 959 Bytes
/
list
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
35
36
37
38
#!/usr/local/bin/python3.8
"""Usage: list [-v]
Output: list of existing Git repository
Options:
-v: Listting with repository description
"""
import os
import sys
from util import *
if __name__ == "__main__":
# cmd_home = os.path.split(sys.argv[0])[0]
help = len(sys.argv) >= 2 and "-h" in sys.argv[1:]
if help:
print(__doc__)
sys.exit(0)
pass
home = get_home_dir()
verbose = len(sys.argv) >= 2 and "-v" in sys.argv[1:]
for dir in get_git_dirs():
if verbose:
try:
with open(os.path.join(dir, "description")) as desc:
print("Repository: {}\n{}".format(dir[len(home)+1:], desc.read()))
pass
pass
except Exception as exc:
# Hum. weird.
pass
pass
else:
print("Repository: {}".format(dir[len(home)+1:]))
pass
pass
pass