예제 #1
0
파일: main.py 프로젝트: amol9/fbstats
def main():
    check_data_dir()

    action.register("plot\s+(?P<type>user_posts)\s+(?P<first_name>\w+)\s+(?P<last_name>\w+)", fb.render_plot)
    action.register("plot\s+(?P<type>\w+)(?:\s+(?P<count>\d+))?", fb.render_plot, {"type": str, "count": int})

    commandline = CommandLine()
    try:
        commandline.execute()
    except CommandLineError as e:
        print(e)
예제 #2
0
파일: main.py 프로젝트: amol9/fbstats
def main():
    check_data_dir()

    action.register(
        "plot\s+(?P<type>user_posts)\s+(?P<first_name>\w+)\s+(?P<last_name>\w+)",
        fb.render_plot)
    action.register("plot\s+(?P<type>\w+)(?:\s+(?P<count>\d+))?",
                    fb.render_plot, {
                        'type': str,
                        'count': int
                    })

    commandline = CommandLine()
    try:
        commandline.execute()
    except CommandLineError as e:
        print(e)
예제 #3
0
파일: simple.py 프로젝트: amol9/redcmd
from redcmd import maincmd, CommandLine, CommandLineError

@maincmd
def main(a, b):
	'''Add two numbers.
	a: 	first number
	b: 	second number

	This is where extra help text goes.
	It can be more than one line.'''

	try:
		print('sum: %d'%(int(a) + int(b)))
	except ValueError:
		print('bad integer')
		raise CommandError()


cmdline = CommandLine()
try:
        cmdline.execute()
except CommandLineError as e:
        print(e)