コード例 #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)