#!/usr/bin/env python

import sys
import plus1s
import argparse


DESP = '''
Are you a real fans?

Type plus1s -h to see the help.
'''

EVAL_MSG = '''
#!/bin/bash

function plus1s_check {
    if [[ $? -ne 0 ]]; then
        plus1s -a
    fi
}

if [[ $0 == "bash" ]]; then
    PROMPT_COMMAND='plus1s_check'
fi    


alias gou='echo 苟利国家生死以，岂因祸福避趋之'
'''

if __name__ == '__main__':
    parser = argparse.ArgumentParser(DESP)
    parser.add_argument('-s', '--sentence', action='store_true',
                        help='Show a sentence of him, with a picture.')
    parser.add_argument('-a', '--alert', action='store_true',
                        help='Show an alert of him.')
    parser.add_argument('-e', '--eval', action='store_true',
                        help='Show the eval message.')
    args = parser.parse_args(sys.argv[1:])

    if args.startup:
        plus1s.start()
    elif args.failure:
        plus1s.show_error_message()
    elif args.eval:
        print(EVAL_MSG)
    else:
        plus1s.plus1s()

