#!/usr/bin/env python3
import os
import sys
import argparse
from getpass import getuser
import webbrowser

VERSION = "0.60"

# for debugging
sys.path.insert(0, os.getcwd())

import azcat

def main ():
    # one program, one easter egg
    if getuser().upper() == "YUI" and os.getcwd() == "azunyan nyan nyan azunyan nyan nyan":
        print("azcat: mou!")
        webbrowser.open("http://www.pixiv.net/member_illust.php?mode=medium&illust_id=29734557")

    parser = argparse.ArgumentParser(description="A alternative to cat(1); specialized for printing files")
    parser.add_argument("file", default="/dev/stdin", nargs="?", help="if it is absent, azcat reads from the stdin")
    parser.add_argument("-f", help="specify the file extension")
    parser.add_argument("-t", help="use of tags files (GNU GLOBAL)")
    parser.add_argument("--with-formatter", action="store_true", help="enable pretty printing")
    parser.add_argument('--version', action='version', version=VERSION)
    args = vars(parser.parse_args())

    azcat.main(args)

if __name__ == "__main__":
    try:
        main()
    except KeyboardInterrupt:
        sys.exit()
