#!/usr/bin/env python3

#
# Development Order #5:
# 
# This file will convert a test specification to command-line options.
#
# This can be tested directly using the following syntax:
# ./cli-to-spec --option argument | ./spec-to-cli

import pscheduler

from validate import spec_is_valid

spec = pscheduler.json_load(exit_on_error=True)

# First, validate the spec
valid, message = spec_is_valid(spec)

if not valid:
    pscheduler.fail(message)

result = pscheduler.speccli_build_args(spec, 
                                       strings=[

        # Add all argument strings here, as tuples
        ( 'host', 'host' ),
        ( 'dest', 'dest' ),
        ( 'source', 'source'),
        ( 'parallel', 'parallel'),
        ( 'cleanup', 'cleanup'),
        ( 'timeout', 'timeout' ),
        ( 'duration', 'duration'),
        ])

pscheduler.succeed_json(result)
