from simplecli import Manager, prompt_choices def create_ctx(config=None, debug=False): print "Creating app context" context = {} context['debug'] = debug context['config'] = {} if config is not None: print "Loading config from", config context['config'].update(simplejson.load(open(config, "r"))) print "context:", context return context manager = Manager(create_ctx) @manager.command def dumpconfig(): "Dumps config" context = manager.context() pprint.pprint(context["config"]) @manager.command def output(name): "print something" print name print type(name)