# Path: mcm.py



from argparse import ArgumentParser, ArgumentTypeError
from json import load as json_load
from os import environ
from getpass import getpass
from mcm import __version__
# -*- coding: UTF-8 -*-




def get_password():
    try:
        return environ['MCM_HOST_PASSWORD']
    except KeyError:
        return getpass()


class JsonFile:

    def __call__(self, file):
        try:
            with open(file, mode='rt', encoding='UTF-8', errors='strict') as fp:
                return json_load(fp)
        except (OSError, IOError) as error:
            msg = 'Can not open {!r}. {}'.format
            raise ArgumentTypeError(msg(file, error))
        except ValueError as error:
            msg = 'Error when parsing config file {!r}. {}'.format
            raise ArgumentTypeError(msg(file, error))


def get_arguments():
    argparser = ArgumentParser(prog='mcm', epilog='By default program will issue a password prompt. If you don\'t want that, store it in MCM_HOST_PASSWORD environment variable.',

# Path: mcm.py



# Path: mcm/args.py
from argparse import ArgumentParser, ArgumentTypeError
from json import load as json_load
from os import environ
from getpass import getpass
from mcm import __version__

# -*- coding: UTF-8 -*-




def get_password():
    try:
        return environ['MCM_HOST_PASSWORD']
    except KeyError:
        return getpass()


class JsonFile:

    def __call__(self, file):
        try:
            with open(file, mode='rt', encoding='UTF-8', errors='strict') as fp:
                return json_load(fp)
        except (OSError, IOError) as error:
            msg = 'Can not open {!r}. {}'.format
            raise ArgumentTypeError(msg(file, error))
        except ValueError as error:
            msg = 'Error when parsing config file {!r}. {}'.format
            raise ArgumentTypeError(msg(file, error))


def get_arguments():
    argparser = ArgumentParser(prog='mcm', epilog='By default program will issue a password prompt. If you don\'t want that, store it in MCM_HOST_PASSWORD environment variable.',

            description='Mikrotik Configuration Manager. Version ' + str(__version__))