#!/usr/bin/env python
"""
Main file for the PhysBiblio application, a bibliography manager written in Python.

This file is part of the physbiblio package.
"""

import sys

try:
	from physbiblio.argParser import setParser, call_gui
	from physbiblio.config import pbConfig
except ImportError:
    print("Could not find physbiblio and its contents: configure your PYTHONPATH!")
    raise

if __name__=='__main__':
	if len(sys.argv) > 1:
		parser = setParser()
		args = parser.parse_args(sys.argv[1:])
		if args.profile is None:
			pbConfig.reloadProfiles()
		args.func(args)
	else:
		pbConfig.reloadProfiles()
		call_gui()
