Пример #1
0
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
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
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)