#!/usr/bin/env python3

# http://inamidst.com/saxo/
# Created by Sean B. Palmer

import os
import subprocess

import saxo

# TODO: Generic shell command
def shell(*args):
    return str(subprocess.check_output(list(args)), "utf-8").rstrip("\r\n")

@saxo.pipe
def wa(arg):
    if not arg:
        return "Compute an expression using Wolfram|Alpha"
    c = os.path.join(os.path.dirname(__file__), "c")
    return shell(c, ":long " + arg)
