start cli framework

This commit is contained in:
Doug Hellmann 2014-10-30 10:45:46 -04:00
parent ae761a1a8a
commit 89c754843e
3 changed files with 45 additions and 1 deletions

View File

39
aeromancer/cli/app.py Normal file
View File

@ -0,0 +1,39 @@
import logging
import sys
from cliff.app import App
from cliff.commandmanager import CommandManager
import pkg_resources
class Aeromancer(App):
log = logging.getLogger(__name__)
def __init__(self):
dist = pkg_resources.get_distribution('aeromancer')
super(Aeromancer, self).__init__(
description='OpenStack source divination',
version=dist.version,
command_manager=CommandManager('aeromancer.cli'),
)
# def initialize_app(self, argv):
# self.log.debug('initialize_app')
# def prepare_to_run_command(self, cmd):
# self.log.debug('prepare_to_run_command %s', cmd.__class__.__name__)
# def clean_up(self, cmd, result, err):
# self.log.debug('clean_up %s', cmd.__class__.__name__)
# if err:
# self.log.debug('got an error: %s', err)
def main(argv=sys.argv[1:]):
myapp = Aeromancer()
return myapp.run(argv)
if __name__ == '__main__':
sys.exit(main(sys.argv[1:]))

View File

@ -43,4 +43,9 @@ input_file = aeromancer/locale/aeromancer.pot
[extract_messages]
keywords = _ gettext ngettext l_ lazy_gettext
mapping_file = babel.cfg
output_file = aeromancer/locale/aeromancer.pot
output_file = aeromancer/locale/aeromancer.pot
[entry_points]
console_scripts =
aeromancer = aeromancer.cli.app:main