#! /usr/bin/env python3

"""
Path searching tool for files associated with the Rivet analysis toolkit.

TODO:
 * Add auto-categorising of the searches based on file extension
 * Add a switch to return all or just the first match
 * Add switches to force searching in a particular file category (libs, info, ref data, plo files)
 * Add partial name / regex searching? (Requires extending the Rivet library)
"""

import rivet, os
rivet.util.set_process_name(os.path.basename(__file__))

import argparse
parser = argparse.ArgumentParser(description=__doc__)
parser.add_argument("ANALYSES", nargs="+", help="analyses to search for")
args = parser.parse_args()

# print rivet.findAnalysisPlotFile()
# print rivet.findAnalysisLibFile()
# print rivet.findAnalysisInfoFile()
# print rivet.findAnalysisRefFile()
for a in args.ANALYSES:
    try:
        print(rivet.findAnalysisRefFile(a))
    except:
        print("No match for '%s'")
