#!/usr/bin/env python

"""
Get the path to gitchangelog.rc.github.release and print it to stdout.
Now uses pkg_resources and accepts one optional argument to return the
reference .rc file instead of the release file.
"""

import sys

if sys.version_info < (3, 10):
    import importlib_resources
else:
    import importlib.resources as importlib_resources


rc_file_name = 'gitchangelog.rc.github.release'


if __name__ == "__main__":

    if len(sys.argv) == 2:
        if 'reference' in sys.argv[1]:
            rc_file_name = 'gitchangelog.rc.reference'
        else:
            print('Unknown argument')
            print("usage: %s [--reference]" % sys.argv[0])
            sys.exit(0)

    # print(pkg_resources.resource_filename('gitchangelog', rc_file_name))

    rc_ref = importlib_resources.files('gitchangelog') / rc_file_name
    print(str(rc_ref))
