Minor updates

This commit is contained in:
sloum 2020-11-12 23:18:42 +00:00
parent 8e0ed54899
commit da245f8840
1 changed files with 9 additions and 7 deletions

16
cspc.py → cspc Normal file → Executable file
View File

@ -23,7 +23,7 @@ class c:
white = '\033[1;37m'
end = '\033[0m'
db_path = './cspc.sqlite'
db_path = '/usr/local/share/cspc/db/cspc'
userdir = os.path.expanduser('~')
user = os.path.split(userdir)[-1]
topic = None
@ -128,17 +128,15 @@ def parse_command(com):
global messages
comlist = ['add', 'help', 'quit', 'back']
if com == 'back':
if com in ['back', 'b']:
go_back()
elif com == 'help':
elif com in ['help', '?', 'h']:
show_help()
elif com in ['quit', 'q', 'exit']:
set_last_log()
sys.exit(0)
elif com == 'add':
elif com == ['add', 'a', 'new']:
make_add()
elif com == 'rm':
make_delete()
else:
try:
ident = int(com)
@ -339,6 +337,10 @@ def mainloop():
if __name__ == '__main__':
signal.signal(signal.SIGINT, signal.SIG_IGN)
check_and_build_db()
try:
check_and_build_db()
except sql.OperationalError:
print("No cspc instance installed. Is the database path valid?")
sys.exit(2)
get_last_log()
mainloop()