-
Notifications
You must be signed in to change notification settings - Fork 0
/
gcrw
executable file
·61 lines (54 loc) · 2.12 KB
/
gcrw
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/usr/bin/env python
import git_class_repo_wrangler as lib
import argh
#import tqdm
def status():
"""Print out the lists of invitees as well as accepted collaborators"""
lib.get_status()
def roster():
"""Returns the class roster from file"""
return(str(lib.get_roster()))
def invite(roster : 'path to roster file' ='roster.csv', users:'flag invite user(s) by gitname'=False, *invitees:'space separated gitnames or a gitname, use with -u'):
"""Allows you to invite the class roster by default or specify a roster path.
Using --users, you can invite individuals by github username or more than one by list separated with spaces"""
if users:
lib.invite_users(invitees)
return "invite commplete"
else:
git_users= lib.get_roster(roster)['git-username'].to_list()
lib.invite_users(git_users)
return "invite commplete"
def files(teams:'flag modifies all other behaviors so they impact teams instead'=False, conflict:'flag make files conclict'=False, delete:'flag to delete all files in either team(--teams) or solo directory '=False):
"""Creates Files for solo by default, deleting existing files. Swtiches modify the behavior to generate
conflicts (--conflict) or to create/conflict team files instead (--teams)."""
if not teams:
if conflict:
lib.make_solo_files_conclict()
return "Files modified"
elif delete:
lib.delete_solo_files()
else:
lib.create_solo_files()
return "Files Created"
else:
if conflict:
lib.make_team_files_conflict()
return "Files modified"
elif delete:
lib.delete_team_files()
else:
lib.make_team_files()
return "Files Created"
def teams(make:'flag make team'=False):
"""Displays teams. --make will create a team"""
if make:
lib.make_teams()
else:
lib.get_teams()
# assembling:
parser = argh.ArghParser()
parser.add_commands([status, roster, invite, files, teams])
parser.set_default_command(status)
# dispatching:
if __name__ == '__main__':
parser.dispatch()