Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 10 additions & 4 deletions wikicurses/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,9 @@

def executeCommand(cmd):
try:
subprocess.call(cmd)
ret = subprocess.call(cmd)
if ret != 0:
ex.notify("Error: command '" + cmd[0] + "' exited with code " + str(ret))
except FileNotFoundError:
ex.notify("Error: command '" + cmd[0] + "' not found.")
loop.screen.clear() # Completely redraw screen after external command
Expand Down Expand Up @@ -259,7 +261,7 @@ def keypress(self, size, key):
maxcol, maxrow = size
ex.notify('') # Clear any notification

cmdmap = settings.conf['keymap']
cmdmap = settings.conf['keymap'] if 'keymap' in settings.conf else {}
if key == ':':
ex.enterexmode()
if key == '/':
Expand Down Expand Up @@ -443,7 +445,7 @@ def openWiki(name):
wiki = name
return
if not name:
name = settings.conf['general']['default']
name = settings.conf.get('general', 'default', fallback='https://en.wikipedia.org/w/api.php')
if name in settings.conf:
wiki = Wiki.fromName(name)
else:
Expand Down Expand Up @@ -516,7 +518,11 @@ def processCmd(cmd, *args):
elif cmd == 'edit':
edit(page.title)
elif cmd == 'help':
executeCommand(['man', 'wikicurses'])
manpage = os.path.dirname(os.path.abspath(__file__)) + '/../wikicurses.1'
if os.path.exists(manpage):
executeCommand(['man', manpage])
else:
executeCommand(['man', 'wikicurses'])
elif cmd == 'back':
if current > 0:
current -= 1
Expand Down