41 lines
927 B
Python
41 lines
927 B
Python
|
""" Test telltale file """
|
||
|
import logging
|
||
|
import os.path
|
||
|
import sys
|
||
|
import tempfile
|
||
|
|
||
|
from mylib.scripts.helpers import get_opts_parser, init_logging
|
||
|
from mylib.telltale import TelltaleFile
|
||
|
|
||
|
log = logging.getLogger(__name__)
|
||
|
|
||
|
default_filepath = os.path.join(tempfile.gettempdir(), f"{__name__}.last")
|
||
|
|
||
|
|
||
|
def main(argv=None):
|
||
|
"""Script main"""
|
||
|
if argv is None:
|
||
|
argv = sys.argv[1:]
|
||
|
|
||
|
# Options parser
|
||
|
parser = get_opts_parser()
|
||
|
options = parser.parse_args()
|
||
|
|
||
|
parser.add_argument(
|
||
|
"-p",
|
||
|
"--telltale-file-path",
|
||
|
action="store",
|
||
|
type=str,
|
||
|
dest="telltale_file_path",
|
||
|
help=f"Telltale file path (default: {default_filepath})",
|
||
|
default=default_filepath,
|
||
|
)
|
||
|
|
||
|
options = parser.parse_args()
|
||
|
|
||
|
# Initialize logs
|
||
|
init_logging(options, __doc__)
|
||
|
|
||
|
telltale_file = TelltaleFile(filepath=options.telltale_file_path)
|
||
|
telltale_file.update()
|