From e2bcd6aea0a481a0bdb05ae5a1ef5f741b3d2b0f Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Fri, 9 May 2014 21:35:33 -0700 Subject: [PATCH] add cdecl, remove explain. fixes #108 --- plugins/cdecl.py | 7 +++++++ plugins/explain.py | 14 -------------- requirements.txt | 1 - 3 files changed, 7 insertions(+), 15 deletions(-) create mode 100644 plugins/cdecl.py delete mode 100644 plugins/explain.py diff --git a/plugins/cdecl.py b/plugins/cdecl.py new file mode 100644 index 0000000..b04b9c9 --- /dev/null +++ b/plugins/cdecl.py @@ -0,0 +1,7 @@ +from util import hook, http + + +@hook.command +def cdecl(inp): + '''.cdecl -- translate between C declarations and English, using cdecl.org''' + return http.get("http://cdecl.org/query.php", q=inp) diff --git a/plugins/explain.py b/plugins/explain.py deleted file mode 100644 index 364605a..0000000 --- a/plugins/explain.py +++ /dev/null @@ -1,14 +0,0 @@ -from util import hook -from pycparser.cdecl import explain_c_declaration - - -@hook.command -def explain(inp): - ".explain -- gives an explanation of C expression" - - inp = inp.encode('utf8', 'ignore') - - try: - return explain_c_declaration(inp) - except Exception, e: - return 'error: %s' % e diff --git a/requirements.txt b/requirements.txt index 2ea4d03..ab90481 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ lxml -pycparser