diff --git a/commands/TEMPLATE.py b/commands/TEMPLATE.py index 7f6a0c81..11da0340 100644 --- a/commands/TEMPLATE.py +++ b/commands/TEMPLATE.py @@ -1,4 +1,4 @@ -from commands import MutuallyExclusiveGroup, ParseArgument +from commands.parsing import MutuallyExclusiveGroup, ParseArgument ###################################################################### # Parser config diff --git a/commands/__init__.py b/commands/__init__.py index aaa4ec12..40e077d0 100644 --- a/commands/__init__.py +++ b/commands/__init__.py @@ -4,17 +4,18 @@ import os import importlib -from commands.exceptions import * -from commands.parsing import * +import commands.exceptions +import commands.parsing commandList = [ + 'buildcache', 'local' ] ###################################################################### # Helpers -class HelpAction(ArgAction): +class HelpAction(argparse.Action): """ argparse action helper for printing the argument usage, because Python 3.4's argparse is ever-so subtly very broken. @@ -31,7 +32,7 @@ def addArguments(group, options, required, topGroup=None): mutually exclusive group of arguments. """ for option in options: - if isinstance(option, MutuallyExclusiveGroup): + if isinstance(option, parsing.MutuallyExclusiveGroup): exGrp = (topGroup or group).add_mutually_exclusive_group() addArguments(exGrp, option.arguments, required, topGroup=group) else: @@ -115,13 +116,13 @@ def parse(self, argv): ### the user requests usage. cmdName = argv[1].lower() if cmdName not in commandList: - raise CommandLineError("Unrecognized command, '{}'".format(cmdName), self.usage(argv)) + raise exceptions.CommandLineError("Unrecognized command, '{}'".format(cmdName), self.usage(argv)) cmdModule = import_module(cmdName) class ArgParser(argparse.ArgumentParser): def error(self, message): - raise CommandLineError(message, self.format_usage()) + raise exceptions.CommandLineError(message, self.format_usage()) parser = ArgParser( description="TradeDangerous: "+cmdName, diff --git a/commands/local_cmd.py b/commands/local_cmd.py index 24cdfd02..abfe6295 100644 --- a/commands/local_cmd.py +++ b/commands/local_cmd.py @@ -1,4 +1,4 @@ -from commands import MutuallyExclusiveGroup, ParseArgument +from commands.parsing import MutuallyExclusiveGroup, ParseArgument import math ###################################################################### diff --git a/commands/nav_cmd.py b/commands/nav_cmd.py index d1655768..44e5add7 100644 --- a/commands/nav_cmd.py +++ b/commands/nav_cmd.py @@ -1,4 +1,4 @@ -from commands import MutuallyExclusiveGroup, ParseArgument +from commands.parsing import MutuallyExclusiveGroup, ParseArgument ###################################################################### # Parser config diff --git a/commands/parsing.py b/commands/parsing.py index 9885d905..e643be14 100644 --- a/commands/parsing.py +++ b/commands/parsing.py @@ -1,6 +1,3 @@ -from commands.exceptions import UsageError -from argparse import Action as ArgAction - ###################################################################### # Parsing Helpers