Move script file
This commit is contained in:
parent
22707b03c1
commit
ae1eff6e4b
2 changed files with 3 additions and 1 deletions
62
src/bin/abgabesystem
Executable file
62
src/bin/abgabesystem
Executable file
|
@ -0,0 +1,62 @@
|
|||
#!/usr/bin/env python3
|
||||
|
||||
import gitlab
|
||||
import argparse
|
||||
import logging
|
||||
|
||||
from abgabesystem.commands import create_users, projects, deadline, plagiates, course
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
||||
gl = gitlab.Gitlab.from_config()
|
||||
gl.auth()
|
||||
log.info('authenticated')
|
||||
|
||||
parser = argparse.ArgumentParser()
|
||||
subparsers = parser.add_subparsers(title='subcommands')
|
||||
|
||||
user_parser = subparsers.add_parser(
|
||||
'users',
|
||||
help='Creates users from LDAP')
|
||||
user_parser.set_defaults(func=create_users)
|
||||
user_parser.add_argument('-s', '--students', dest='students')
|
||||
user_parser.add_argument('-b', '--ldap-base', dest='ldap_base')
|
||||
user_parser.add_argument('-p', '--ldap-provider', dest='ldap_provider')
|
||||
|
||||
course_parser = subparsers.add_parser(
|
||||
'courses',
|
||||
help='Creates a new course')
|
||||
course_parser.set_defaults(func=course)
|
||||
course_parser.add_argument('-c', '--course', dest='course')
|
||||
|
||||
projects_parser = subparsers.add_parser(
|
||||
'projects',
|
||||
help='Sets up the projects and groups for a course')
|
||||
projects_parser.set_defaults(func=projects)
|
||||
projects_parser.add_argument('-c', '--course', dest='course')
|
||||
projects_parser.add_argument('-d', '--deploy-key', dest='deploy_key')
|
||||
projects_parser.add_argument('-s', '--students', dest='students')
|
||||
|
||||
deadline_parser = subparsers.add_parser(
|
||||
'deadline',
|
||||
description='Sets the tags at a deadline to permanently mark it in the version history')
|
||||
deadline_parser.set_defaults(func=deadline)
|
||||
deadline_parser.add_argument('-t', '--tag-name', dest='tag_name')
|
||||
deadline_parser.add_argument('-r', '--reference', dest='reference')
|
||||
|
||||
plagiates_parser = subparsers.add_parser(
|
||||
'plagiates',
|
||||
description='Runs the plagiarism checker on all solutions using a reference project as the baseline')
|
||||
plagiates_parser.set_defaults(func=plagiates)
|
||||
plagiates_parser.add_argument('-t', '--tag-name', dest='tag_name')
|
||||
plagiates_parser.add_argument('-r', '--reference', dest='reference')
|
||||
plagiates_parser.add_argument('-j', '--jplag-jar', dest='jplag_jar')
|
||||
|
||||
args = parser.parse_args()
|
||||
|
||||
log.basicConfig(filename='example.log', filemode='w', level=log.DEBUG)
|
||||
|
||||
if 'func' in args:
|
||||
args.func(gl, args)
|
||||
else:
|
||||
parser.print_help()
|
Loading…
Add table
Add a link
Reference in a new issue