Commit a584be73 authored by adam j hartz's avatar adam j hartz

Merge branch 'master' into 'master'

Fix bugs with loading/reading nonexistent/empty bookmark files

See merge request !1
parents ee5e0821 13be6df8
......@@ -84,14 +84,15 @@ def _load_bookmarks(args, stdin=None):
fname = os.path.join($TAKO_SETTINGS.data_dir, 'plugins', 'bookmark', 'bookmarks.json')
os.makedirs(os.path.dirname(fname), exist_ok=True)
with open(fname) as f: = json.load(f)
if os.path.isfile(fname):
with open(fname) as f: = json.load(f)
def _list_bookmarks(args, stdin=None):
if len(args) > 0:
return None, _LIST_USAGE, 1
leftside_len = max(len(i) for i in + 3
leftside_len = max(len(i) for i in, default=0) + 3
out = ''
for k, v in sorted(
out += '%s \033[0;36m%s\033[0m %s\n' % (k, '.' * (leftside_len-len(k)), v)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment