Support running with no args - show help

This commit is contained in:
Nick Pegg 2024-08-05 08:08:25 -07:00
parent acd736c970
commit c08c5609ca

View file

@ -1,4 +1,5 @@
import logging
import sys
from argparse import ArgumentParser, Namespace
from pathlib import Path
@ -15,6 +16,7 @@ def main() -> None:
setup_logging(args.logging)
# Load config from file if it exists
if hasattr(args, "album_path"):
conf_path = Path(args.album_path) / Path(args.config)
if conf_path.exists():
logger.debug(f"Reading config from {conf_path}")
@ -98,7 +100,12 @@ def parse_args() -> Namespace:
help="Path to the main photos directory",
)
return parser.parse_args()
args = parser.parse_args()
if not hasattr(args, 'action'):
parser.print_help()
sys.exit(0)
return args
########################################