#!/usr/bin/env python

"""
Output the list of standard makefile args to the command line.  This script
should only be used when the components buildlib is not written in python
"""

from standard_script_setup import *

from CIME.build 	  import get_standard_makefile_args
from CIME.case            import Case
from CIME.test_status     import *

###############################################################################
def parse_command_line(args, description):
###############################################################################
    parser = argparse.ArgumentParser(
        description=description,
        formatter_class=argparse.RawTextHelpFormatter)

    CIME.utils.setup_standard_logging_options(parser)
    parser.add_argument("caseroot", nargs="?", default=os.getcwd(),
                        help="Case directory to build.\n"
                        "Default is current directory.")

    args = CIME.utils.parse_args_and_handle_standard_logging_options(args, parser)

    return args.caseroot

###############################################################################
def _main_func(description):
###############################################################################
    caseroot = parse_command_line(sys.argv, description)

    success = True
    with Case(caseroot) as case:
        print(get_standard_makefile_args(case))

    sys.exit(0 if success else 1)

if __name__ == "__main__":
    _main_func(__doc__)
