summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorSanto Cariotti <sancn@live.com>2017-09-17 14:25:45 +0200
committerSanto Cariotti <sancn@live.com>2017-09-17 14:25:45 +0200
commit3282fe91dd01f006b416c0057f8c59f3b1b950d9 (patch)
treed61d7b9c4055540c180af3c8cd729bdfe7e28e72 /lib
parentf731b101668425fe3d675442b765dac53c9e27e7 (diff)
fixed 'add' when the username is empty
Diffstat (limited to 'lib')
-rw-r--r--lib/commands.py6
1 files changed, 4 insertions, 2 deletions
diff --git a/lib/commands.py b/lib/commands.py
index 942bc0e..3df279c 100644
--- a/lib/commands.py
+++ b/lib/commands.py
@@ -88,8 +88,10 @@ class Commands(object):
msg = ' '.join(cmd[1:]) #join first word after 'add' to last word
try:
- with open(co['path'], 'ab') as fout:
- fout.seek(1, 1)
+ with open(co['path'], 'ab+') as fout:
+ if fout.readline().decode('utf-8') == '':
+ fout.write(('\n').encode('utf-8'))
+
fout.write((msg + '\n').encode('utf-8'))
print('Ok')