import os
from functools import partial, wraps

import docopt
import six
from six.moves import urllib

import dcoscli
from dcos import (cmds, config, emitting, errors,
                  http, mesos, packagemanager, subprocess, util)
from dcos.cosmos import get_cosmos_url
from dcos.errors import DCOSException, DefaultError
from dcoscli import log, metrics, tables
from dcoscli.subcommand import default_command_info, default_doc
from dcoscli.util import confirm, decorate_docopt_usage


logger = util.get_logger(__name__)
emitter = emitting.FlatEmitter()

DIAGNOSTICS_BASE_URL = '/system/health/v1/report/diagnostics/'


# if a bundle size if more then 100Mb then warn user.
BUNDLE_WARN_SIZE = 100 * 1000 * 1000


def main(argv):
    try:
        return _main(argv)
    except DCOSException as e:
        emitter.publish(e)
        return 1


@decorate_docopt_usage
def _main(argv):
    args = docopt.docopt(
        default_doc("node"),