Skip to content

Commit

Permalink
Intialize argparser fully before parsing arguments.
Browse files Browse the repository at this point in the history
  • Loading branch information
Warren Turkal committed Feb 9, 2012
1 parent ff8788a commit 167fab0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
11 changes: 3 additions & 8 deletions cli/hack.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,16 @@ def main():
logging.info('Initial working directory: %s', os.getcwd())

parser = get_parser()
known_args, extra_args = parser.parse_known_args()
plugin_modules = get_plugin_modules(known_args.plugins)
plugin_modules = get_plugin_modules(
digg.dev.hackbuilder.plugins.plugin_names)
digg.dev.hackbuilder.plugins.initialize_plugins(plugin_modules, parser)
args = parser.parse_args()
digg.dev.hackbuilder.plugins.share_args_with_plugins(plugin_modules, args)
args.func(args)


def get_parser():
parser = argparse.ArgumentParser(description='Hack build tool.',
add_help=False)
parser.add_argument('--plugins',
action='append',
default=['debian', 'python'],
help='List of plugins to load')
parser = argparse.ArgumentParser(description='Hack build tool.')
subparsers = parser.add_subparsers(title='Subcommands')

parser_help = subparsers.add_parser('help', help='Subcommand help')
Expand Down
5 changes: 5 additions & 0 deletions plugins/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,11 @@
import digg.dev.hackbuilder.errors


plugin_names = [
'python',
'debian',
]

def _get_all_build_file_rules_generators(plugins):
build_file_rules_generators = set()
for plugin in plugins:
Expand Down

0 comments on commit 167fab0

Please sign in to comment.