Support running with no args - show help
This commit is contained in:
parent
acd736c970
commit
c08c5609ca
1 changed files with 18 additions and 11 deletions
|
@ -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
|
||||
|
||||
|
||||
########################################
|
||||
|
|
Loading…
Add table
Reference in a new issue