Skip to content

Commit

Permalink
revert "remove code duplication (#648)" (#667)
Browse files Browse the repository at this point in the history
With this change, we need to specify the imports in pyinstaller spec
file, so leave as is.
  • Loading branch information
tamarrow authored Jun 28, 2016
1 parent 18dd1f0 commit c5faea4
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 5 deletions.
25 changes: 20 additions & 5 deletions cli/dcoscli/subcommand.py
Original file line number Diff line number Diff line change
@@ -1,20 +1,35 @@
import traceback
from importlib import import_module

import pkg_resources

from dcos import subcommand


# must also add subcommand name to dcos.subcommand.default_subcommands
def _default_modules():
"""Dict of the default dcos cli subcommands and their main methods
:returns: default subcommand -> main method
:rtype: {}
"""

defaults = subcommand.default_subcommands()
return {s: import_module('dcoscli.{}.main'.format(s)) for s in defaults}
# avoid circular imports
from dcoscli.auth import main as auth_main
from dcoscli.config import main as config_main
from dcoscli.help import main as help_main
from dcoscli.marathon import main as marathon_main
from dcoscli.node import main as node_main
from dcoscli.package import main as package_main
from dcoscli.service import main as service_main
from dcoscli.task import main as task_main

return {'auth': auth_main,
'config': config_main,
'help': help_main,
'marathon': marathon_main,
'node': node_main,
'package': package_main,
'service': service_main,
'task': task_main
}


def default_doc(command):
Expand Down
1 change: 1 addition & 0 deletions dcos/subcommand.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,7 @@ def distributions():
return []


# must also add subcommand name to dcoscli.subcommand._default_modules
def default_subcommands():
"""List the default dcos cli subcommands
Expand Down

0 comments on commit c5faea4

Please sign in to comment.