From 42062fa7a7a3923b7a1d5cc6d2db11774aba7c8c 2008-08-27 17:25:35 From: Ville M. Vainio Date: 2008-08-27 17:25:35 Subject: [PATCH] add ipy_miscapps.py, with one completer (surfraw) --- diff --git a/IPython/Extensions/ipy_miscapps.py b/IPython/Extensions/ipy_miscapps.py new file mode 100644 index 0000000..e6f8e5b --- /dev/null +++ b/IPython/Extensions/ipy_miscapps.py @@ -0,0 +1,19 @@ +""" Completers for miscellaneous command line apps + +""" +import IPython.ipapi +ip = IPython.ipapi.get() +import os + +def surfraw_completer(self,cmdline): + """ Completer for 'surfraw' + + example:: + sr go => sr google + + """ + compl = [l.split(None,1)[0] for l in os.popen('sr -elvi')] + return compl + + +ip.set_hook('complete_command', surfraw_completer, str_key = 'sr') \ No newline at end of file