예제 #1
0
def main_choose(args, config):
    """CLI program command: choose
    Select or change a project license.
    """
    if args.license in license_handling.get_license_list():
        def arg_to_parameters(string_list):
            return dict(pair.split(":")
                        for arg in string_list
                        for pair in arg.split(","))

        if args.parameters:
            try:
                args.parameters = arg_to_parameters(args.parameters)
            except TypeError:
                print("ERROR: Parameter input not formatted properly")
                exit(1)

        config["License"] = args.license

        userfiles_handling.update_license(config)

    else:
        print(("WARNING: {} is not a supported license. Please use the list"
               " command to see a list of supported licenses."
              ).format(args.license))
예제 #2
0
def main_list(args, config):
    """CLI program command: list
    Output each supported license by name.
    """
    for license_name in license_handling.get_license_list():
        print(license_name)