예제 #1
0
from paramSeeker import ParamSeeker, __version__

seeker = ParamSeeker()

# add usage
seeker.set_usage_desc("seeker [OPTION]... ")
seeker.set_usage_desc('seeker thing')

seeker.set_desc("this is like a demo to tell how to use this package\n" +
                "also, this is my test project, with the name of seek\n" +
                "which is sick to see the source code, but the code is\n" +
                "at your source code dir, and you can visit\n\n" +
                "https://github.com/hellflame/paramSeeker/blob/master/seeker/example.py\n" +
                "reference at http://hellflame.github.io/doc/paramSeeker-doc/")


@seeker.seek('--linux', short='-l', extra={'desc': 'this is a test function', 'single_param': True})
def first(wanted):
    result = '\nthis is the first test method and it has got the argument \n\t`\033[01;31m{}\033[00m`\n'.\
        format(wanted)
    return result


@seeker.seek('--black', short='-b', extra={'desc': 'this is a test function with the param head black'})
def second(wanted):
    result = '\nthis is the second test method and it has got the argument \n\t`\033[01;33m{}\033[00m`\n'.\
        format(wanted)
    return result


@seeker.seek('--tell', short='-t', is_mark=True, extra={'desc': 'I may tell you something'})
예제 #2
0
    if wanted == '.':
        if font_check(font_path, font_list):
            print('请运行 -i or --init 初始化字体库\n或者-h or --help 帮助')
            default['init'] = True
            return ''
        else:
            return ''
    else:
        if path.exists(wanted):
            default['file'] = wanted
            return ''
        return '米有找到→_→ {} ←_←这个文件的说喵'.format(wanted)


seeker.set_desc("terminal text or image printer")
seeker.set_usage_desc("terminalprint -[tFmcf] [param,]")
seeker.set_usage_desc("terminalprint picture.jpg")
seeker.set_usage_desc("terminalprint -t linux -m r_color")
seeker.set_usage_desc("terminalprint -t 测试 -m color -c 5")
seeker.set_usage_desc("terminalprint -t 女王大人 -F 1 -m r_color")


def runner():
    seeker.run(no_output=True)
    if default['init']:
        exit(0)

    if default['file']:
        printer.set_img(default['file'])
        pic_str = printer.make_char_img(filter_type=default['Filter'])