Mark required arguments in scripts as required

This commit is contained in:
Patrick Jentsch 2022-02-03 10:40:25 +01:00
parent a2e8e72e54
commit 6f0545e48b
2 changed files with 8 additions and 3 deletions

View File

@ -23,7 +23,8 @@ parser = ArgumentParser(
) )
parser.add_argument( parser.add_argument(
'-i', '--input-file', '-i', '--input-file',
help='Input file' help='Input file',
required=True
) )
parser.add_argument( parser.add_argument(
'-o', '--output-file', '-o', '--output-file',

View File

@ -6,16 +6,19 @@ from stand_off_data import StandOffData
import hashlib import hashlib
import json import json
parser = ArgumentParser( parser = ArgumentParser(
description='Convert plain text and JSON stand off to a CWB vrt file' description='Convert plain text and JSON stand off to a CWB vrt file'
) )
parser.add_argument( parser.add_argument(
'-s', '--stand-off-data-file', '-s', '--stand-off-data-file',
help='JSON stand off data input file' help='JSON stand off data input file',
required=True
) )
parser.add_argument( parser.add_argument(
'-t', '--text-file', '-t', '--text-file',
help='Plain text input file' help='Plain text input file',
required=True
) )
parser.add_argument( parser.add_argument(
'-o', '--output-file', '-o', '--output-file',
@ -24,6 +27,7 @@ parser.add_argument(
) )
args = parser.parse_args() args = parser.parse_args()
with open(args.stand_off_data_file) as stand_of_data_file: with open(args.stand_off_data_file) as stand_of_data_file:
stand_off_data = StandOffData(json.load(stand_of_data_file)) stand_off_data = StandOffData(json.load(stand_of_data_file))