Skip to content

Commit

Permalink
via VSC
Browse files Browse the repository at this point in the history
  • Loading branch information
Daethyra authored May 8, 2023
1 parent 89fefca commit 11de006
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 12 deletions.
Empty file added converter.log
Empty file.
25 changes: 13 additions & 12 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -146,6 +146,7 @@ def print_available_conversion_types():
print("Usage instructions:")
print(" Interactive mode: python main.py")
print(" Batch mode: python main.py --batch <directory_path> <output_format>")

if len(sys.argv) == 1:
print("Interactive mode.")
print("Enter 'quit' at any time to exit.")
Expand Down Expand Up @@ -204,22 +205,22 @@ def print_available_conversion_types():
print(f"Error converting {input_file}: {str(e)}")
logging.error(f"Error converting {input_file}: {str(e)}")

elif sys.argv[1].lower() == "--batch":
if len(sys.argv) != 4:
print("Usage: python main.py --batch <directory_path> <output_format>")
sys.exit(1)
elif len(sys.argv) > 1 and sys.argv[1].lower() == "--batch":
if len(sys.argv) != 4:
print("Usage: python main.py --batch <directory_path> <output_format>")
sys.exit(1)

directory_path = sys.argv[2]
output_format = sys.argv[3].lower()
directory_path = sys.argv[2]
output_format = sys.argv[3].lower()

if not output_format.startswith('.'):
output_format = '.' + output_format
if not output_format.startswith('.'):
output_format = '.' + output_format

if not os.path.exists(directory_path) or not os.path.isdir(directory_path):
print(f"Directory '{directory_path}' does not exist.")
sys.exit(1)
if not os.path.exists(directory_path) or not os.path.isdir(directory_path):
print(f"Directory '{directory_path}' does not exist.")
sys.exit(1)

batch_process(directory_path, output_format)
batch_process(directory_path, output_format)

else:
print("Invalid command.")
Expand Down

0 comments on commit 11de006

Please sign in to comment.