#!/usr/bin/env python

#
# Project Librarian: Brandon Piotrzkowski
#              Graduate Student
#              UW-Milwaukee Department of Physics
#              Center for Gravitation & Cosmology
#              <brandon.piotrzkowski@ligo.org>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#

"""
Script to generate pdf file of speed of gravity manuscript.
"""
__author__ = "Brandon Piotrzkowski <brandon.piotrzkowski@ligo.org>"

from SoG.tex.generate_upload_pdf import generate_pdf

import argparse

#  Command line options.
parser = argparse.ArgumentParser(description='Perform query of GraceDB')
parser.add_argument("-i", "--graceid", metavar="(S,MS)XXXXXX",
                    default=None,
                    help="GraceDB ID of superevent (required)"),
parser.add_argument("-u", "--gracedb_url", metavar="https://gracedb.ligo.org/api/",
                    default="https://gracedb.ligo.org/api/",
                    help="Gracedb url"),
parser.add_argument("-l", "--keep_local_copy", dest="keep_local_copy", action="store_true",
                    help="Keep local copy of pdf (and tarball of files if compressed)."),
parser.add_argument("-c", "--compress_files", dest="compress_files", action="store_true",
                    help="Create tarball of all files."),
parser.add_argument("-L", "--use_latexmk", dest="use_latexmk", action="store_true",
                    help="Use latexmk instead of pdflatex to create pdf."),
parser.add_argument("-t", "--use_test_macrofile", dest="use_test_macrofile", action="store_true",
                    help="Use local test macro file rather than querying GraceDB.")
args = parser.parse_args()
print(args)

#  Run function from repository
generate_pdf(args.graceid, args.gracedb_url, args.keep_local_copy, 
             args.compress_files, args.use_latekmk, args.use_test_macrofile)