def main()

in deployment/macos/mobiledevicemanagement/mobile_config_gen.py [0:0]


def main(argv):

    output_file = str()

    parser = argparse.ArgumentParser()
    parser.add_argument("-n", "--name", help="The name of your company", action="store", required=True, type=str, dest="name")
    parser.add_argument("-o", "--output", help="The absolute path to the mobileconfig that will be written out by this script", action="store", required=True, type=str, dest="output_file_path")

    args = parser.parse_args()

    output_file = args.output_file_path

    # Ensure a directory is not specified
    if os.path.isdir(output_file):
        print("Please specify a file name in the output path")
        exit(-1)

    # Ensure the file ends with .mobileconfig extension
    if output_file.endswith(".mobileconfig") == False:
        output_file += ".mobileconfig"


    with open(output_file, 'w', encoding='utf-8') as output_config_file:

        pos_args = [str(uuid.uuid4()).upper() for _ in range (  6)]

        output_data = template.format(*pos_args, args.name)
        output_config_file.write(output_data)