#!/usr/bin/env python3
#
# convert-conf - the configuration file converter
#
# USAGE
#
#   $ format-config [-t JSON|MCD] config-esr60.txt

import re
import sys
import glob
import json
import getopt
import os

BASEDIR = os.path.dirname(os.path.realpath(__file__))
sys.path.append(BASEDIR)

import adlib

def usage():
    print('Usage: %s -t (json|mcd) config-esr60.txt' % sys.argv[0])

#
# Format

def print_mcd(dic):
    for key in dic:
        if dic[key].strip() == '-':
            continue
        print('//', key)
        print(dic[key])
        print()

#
# Main

def main(args):
    opts, args = getopt.getopt(args, "t:")

    fmt = 'JSON'
    for k, v in opts:
        if k == '-t':
            fmt = v.upper()

    if len(args) < 1:
        usage()
        sys.exit(1)

    dic = adlib.load_as_dict(args[0])

    if fmt == 'MCD':
        print_mcd(dic)
    elif fmt == 'JSON':
        print(json.dumps(dic, indent=True))
    else:
        raise ValueError("unknown format: %s" % fmt)
    return 0

if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))

b12ee17339572d36dad6f31fc2de287870f2f3da
<mask token>


def usage():
    print('Usage: %s -t (json|mcd) config-esr60.txt' % sys.argv[0])


def print_mcd(dic):
    for key in dic:
        if dic[key].strip() == '-':
            continue
        print('//', key)
        print(dic[key])
        print()


def main(args):
    opts, args = getopt.getopt(args, 't:')
    fmt = 'JSON'
    for k, v in opts:
        if k == '-t':
            fmt = v.upper()
    if len(args) < 1:
        usage()
        sys.exit(1)
    dic = adlib.load_as_dict(args[0])
    if fmt == 'MCD':
        print_mcd(dic)
    elif fmt == 'JSON':
        print(json.dumps(dic, indent=True))
    else:
        raise ValueError('unknown format: %s' % fmt)
    return 0


<mask token>

<mask token>
sys.path.append(BASEDIR)
<mask token>


def usage():
    print('Usage: %s -t (json|mcd) config-esr60.txt' % sys.argv[0])


def print_mcd(dic):
    for key in dic:
        if dic[key].strip() == '-':
            continue
        print('//', key)
        print(dic[key])
        print()


def main(args):
    opts, args = getopt.getopt(args, 't:')
    fmt = 'JSON'
    for k, v in opts:
        if k == '-t':
            fmt = v.upper()
    if len(args) < 1:
        usage()
        sys.exit(1)
    dic = adlib.load_as_dict(args[0])
    if fmt == 'MCD':
        print_mcd(dic)
    elif fmt == 'JSON':
        print(json.dumps(dic, indent=True))
    else:
        raise ValueError('unknown format: %s' % fmt)
    return 0


if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))

<mask token>
BASEDIR = os.path.dirname(os.path.realpath(__file__))
sys.path.append(BASEDIR)
<mask token>


def usage():
    print('Usage: %s -t (json|mcd) config-esr60.txt' % sys.argv[0])


def print_mcd(dic):
    for key in dic:
        if dic[key].strip() == '-':
            continue
        print('//', key)
        print(dic[key])
        print()


def main(args):
    opts, args = getopt.getopt(args, 't:')
    fmt = 'JSON'
    for k, v in opts:
        if k == '-t':
            fmt = v.upper()
    if len(args) < 1:
        usage()
        sys.exit(1)
    dic = adlib.load_as_dict(args[0])
    if fmt == 'MCD':
        print_mcd(dic)
    elif fmt == 'JSON':
        print(json.dumps(dic, indent=True))
    else:
        raise ValueError('unknown format: %s' % fmt)
    return 0


if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))

import re
import sys
import glob
import json
import getopt
import os
BASEDIR = os.path.dirname(os.path.realpath(__file__))
sys.path.append(BASEDIR)
import adlib


def usage():
    print('Usage: %s -t (json|mcd) config-esr60.txt' % sys.argv[0])


def print_mcd(dic):
    for key in dic:
        if dic[key].strip() == '-':
            continue
        print('//', key)
        print(dic[key])
        print()


def main(args):
    opts, args = getopt.getopt(args, 't:')
    fmt = 'JSON'
    for k, v in opts:
        if k == '-t':
            fmt = v.upper()
    if len(args) < 1:
        usage()
        sys.exit(1)
    dic = adlib.load_as_dict(args[0])
    if fmt == 'MCD':
        print_mcd(dic)
    elif fmt == 'JSON':
        print(json.dumps(dic, indent=True))
    else:
        raise ValueError('unknown format: %s' % fmt)
    return 0


if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))

#!/usr/bin/env python3
#
# convert-conf - the configuration file converter
#
# USAGE
#
#   $ format-config [-t JSON|MCD] config-esr60.txt

import re
import sys
import glob
import json
import getopt
import os

BASEDIR = os.path.dirname(os.path.realpath(__file__))
sys.path.append(BASEDIR)

import adlib

def usage():
    print('Usage: %s -t (json|mcd) config-esr60.txt' % sys.argv[0])

#
# Format

def print_mcd(dic):
    for key in dic:
        if dic[key].strip() == '-':
            continue
        print('//', key)
        print(dic[key])
        print()

#
# Main

def main(args):
    opts, args = getopt.getopt(args, "t:")

    fmt = 'JSON'
    for k, v in opts:
        if k == '-t':
            fmt = v.upper()

    if len(args) < 1:
        usage()
        sys.exit(1)

    dic = adlib.load_as_dict(args[0])

    if fmt == 'MCD':
        print_mcd(dic)
    elif fmt == 'JSON':
        print(json.dumps(dic, indent=True))
    else:
        raise ValueError("unknown format: %s" % fmt)
    return 0

if __name__ == '__main__':
    sys.exit(main(sys.argv[1:]))
