# Path: resync/url_or_file_open.py
# def set_url_or_file_open_config(key, value):
#     """Set the global config."""
#     global CONFIG
#     CONFIG[key] = value


import argparse
import logging
import logging.config
from datetime import datetime
from .url_or_file_open import set_url_or_file_open_config
    # Want these to show at the end
    opt.add_argument('--logger', '-l', action='store_true',
                     help="create detailed log of client actions (will write "
                          "to %s unless specified with --logfile" % (default_logfile))
    opt.add_argument('--logfile', type=str, action='store',
                     help="create detailed log of client actions")
    opt.add_argument('--spec-version', default='1.1', choices=('1.0', '1.1'),
                     help="follow given ResourceSync specification version. The key difference is that v1.0 "
                          "used lastmod for the time of a change (often also the resource Last-Modification "
                          "time but not always). In v1.1 the rs:md datetime attribute in a ChangeList "
                          "indicates the time of the change, and use of lastmod is entirely optional")
    opt.add_argument('--verbose', '-v', action='store_true',
                     help="verbose, show additional informational messages")


def process_shared_misc_options(args, include_remote=False):
    """Process shared miscellaneous options in args.

    Parse options that the resync-sync, resync-build and resync-explorer scripts use.
    """
    if args.checksum and 'md5' not in args.hash:
        args.hash.append('md5')
    if include_remote:
        if args.access_token:
            set_url_or_file_open_config('bearer_token', args.access_token)
        if args.delay:
            if args.delay < 0.0:
                raise argparse.ArgumentTypeError("--delay must be non-negative!")
            set_url_or_file_open_config('delay', args.delay)
        if args.user_agent:

# Path: resync/url_or_file_open.py
# def set_url_or_file_open_config(key, value):
#     """Set the global config."""
#     global CONFIG
#     CONFIG[key] = value


# Path: resync/client_utils.py
import argparse
import logging
import logging.config
from datetime import datetime
from .url_or_file_open import set_url_or_file_open_config

    # Want these to show at the end
    opt.add_argument('--logger', '-l', action='store_true',
                     help="create detailed log of client actions (will write "
                          "to %s unless specified with --logfile" % (default_logfile))
    opt.add_argument('--logfile', type=str, action='store',
                     help="create detailed log of client actions")
    opt.add_argument('--spec-version', default='1.1', choices=('1.0', '1.1'),
                     help="follow given ResourceSync specification version. The key difference is that v1.0 "
                          "used lastmod for the time of a change (often also the resource Last-Modification "
                          "time but not always). In v1.1 the rs:md datetime attribute in a ChangeList "
                          "indicates the time of the change, and use of lastmod is entirely optional")
    opt.add_argument('--verbose', '-v', action='store_true',
                     help="verbose, show additional informational messages")


def process_shared_misc_options(args, include_remote=False):
    """Process shared miscellaneous options in args.

    Parse options that the resync-sync, resync-build and resync-explorer scripts use.
    """
    if args.checksum and 'md5' not in args.hash:
        args.hash.append('md5')
    if include_remote:
        if args.access_token:
            set_url_or_file_open_config('bearer_token', args.access_token)
        if args.delay:
            if args.delay < 0.0:
                raise argparse.ArgumentTypeError("--delay must be non-negative!")
            set_url_or_file_open_config('delay', args.delay)
        if args.user_agent:

            set_url_or_file_open_config('user_agent', args.user_agent)