Make --pickle-path arg optional

This commit is contained in:
Christophe Bedard 2019-06-27 10:35:46 +02:00
parent 9b48c620ed
commit 87396b2710

View file

@ -16,16 +16,25 @@
"""Entrypoint/script to convert CTF trace data to a pickle file.""" """Entrypoint/script to convert CTF trace data to a pickle file."""
import argparse import argparse
import os
import time import time
from tracetools_analysis.conversion import ctf from tracetools_analysis.conversion import ctf
def parse_args(): def parse_args():
parser = argparse.ArgumentParser(description='Convert CTF trace data to a pickle file.') parser = argparse.ArgumentParser(
parser.add_argument('trace_directory', help='the path to the main CTF trace directory') description='Convert CTF trace data to a pickle file.')
parser.add_argument('pickle_path', help='the path to the target pickle file to generate') parser.add_argument(
return parser.parse_args() 'trace_directory', help='the path to the main CTF trace directory')
parser.add_argument(
'--pickle-path', '-p',
help='the path to the target pickle file to generate (default: $trace_directory/pickle)')
args = parser.parse_args()
if args.pickle_path is None:
args.pickle_path = os.path.join(args.trace_directory, 'pickle')
print(args.pickle_path)
return args
def main(): def main():