#!/usr/bin/env python3

import sys
sys.path.append('lib')

import argparse
from charms.layer import options


parser = argparse.ArgumentParser(description='Access layer options.')
parser.add_argument('section',
                    help='the section, or layer, the option is from')
parser.add_argument('option',
                    help='the option to access')

args = parser.parse_args()
value = options(args.section).get(args.option, '')
if isinstance(value, bool):
    sys.exit(0 if value else 1)
elif isinstance(value, list):
    for val in value:
        print(val)
else:
    print(value)
