#!/usr/bin/env python3

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

import os
import subprocess

import saxo

@saxo.pipe
def t(arg):
    arg = arg if arg else saxo.env("url")
    if not arg:
        return "Give me a link, a twitter ID, or a twitter name"

    if arg[0] in "0123456789":
        return saxo.call("tw", arg)
    elif ("//twitter.com/" in arg) or ("//mobile.twitter.com/" in arg):
        return saxo.call("tw", arg)
    elif "/" in arg:
        return saxo.call("title", arg)
    else:
        return saxo.call("tw", arg)
