Skip to content

Commit

Permalink
2549 Add validation to prevent using '-f' and '-fp' options together …
Browse files Browse the repository at this point in the history
…in find_range.py
  • Loading branch information
id774 committed Nov 16, 2024
1 parent 0fec8de commit 2adde77
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions find_range.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,8 @@
# Error Conditions and Return Codes:
# 0: Success
# 1: Specified path does not exist or no arguments provided
# 2: Incorrect datetime format
# 3: Python version not supported.
# 2: Incorrect datetime format or mutually exclusive options '-f' and '-fp' were used together
# 3: Python version not supported
#
########################################################################

Expand All @@ -107,6 +107,10 @@ def parse_arguments():
parser.add_argument('-l', '--localtime', action='store_true', help='Use local timezone for input and output times instead of UTC.')
args = parser.parse_args()

# Check for invalid combination of options
if args.filenames and args.fullpath:
parser.error("Options '-f' and '-fp' cannot be used together.")

# Ensure that at least one datetime argument is provided
if not any([args.datetime, args.start, args.end]):
parser.print_help()
Expand Down

0 comments on commit 2adde77

Please sign in to comment.