Commit 84c93747 authored by Jonathan Jenkins's avatar Jonathan Jenkins
Browse files

configurator - get values for particular replace token

parent 730f50ca
import argparse
import sys
from itertools import islice
import configurator as conf
def main():
args = parse_args()
mod = conf.import_from(args.substitute_py)
for pair in mod.cfields:
if pair[0] == args.token:
for x in islice(pair[1],1,None):
sys.stdout.write(" " + str(x))
sys.exit(0) # success
else: # failure, did not find
raise ValueError('could not find token "' + args.token + '"')
def parse_args():
parser = argparse.ArgumentParser(\
description="echo the values of a token file to stdout")
help='python file defining "cfields" variable consisting of '
'elements of the form '
'( replacement_token, [replacements...])')
help="replacement token to print values out for")
return parser.parse_args()
if __name__ == "__main__":
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment