From 777e768243458f63c35e08da0f6efcc19fe67617 Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Sat, 28 Aug 2021 07:23:17 -0700 Subject: [PATCH] Added selected and quit to repl --- osxphotos/_version.py | 2 +- osxphotos/cli.py | 18 ++++++++++++++++-- 2 files changed, 17 insertions(+), 3 deletions(-) diff --git a/osxphotos/_version.py b/osxphotos/_version.py index 90aaf9a3..3bf01fa3 100644 --- a/osxphotos/_version.py +++ b/osxphotos/_version.py @@ -1,3 +1,3 @@ """ version info """ -__version__ = "0.42.74" +__version__ = "0.42.75" diff --git a/osxphotos/cli.py b/osxphotos/cli.py index 0b06ecc1..fe9255b0 100644 --- a/osxphotos/cli.py +++ b/osxphotos/cli.py @@ -4093,16 +4093,30 @@ def repl(ctx, cli_obj, db): get_photo = photosdb.get_photo show = _show_photo get_selected = _get_selected(photosdb) + selected = get_selected() def inspect(obj): """inspect object""" return _inspect(obj, methods=True) + class ReprQuit: + def __repr__(self): + sys.exit(0) + + def __call__(self): + sys.exit(0) + + quit = ReprQuit() + q = ReprQuit() + print(f"Found {len(photos)} photos in {tictoc:0.2f} seconds") print("The following variables are defined:") print(f"- photosdb: PhotosDB() instance for {photosdb.library_path}") print( - f"- photos: list of PhotoInfo objects for all photos in photosdb, including those in the trash" + f"- photos: list of PhotoInfo objects for all photos in photosdb, including those in the trash (len={len(photos)})" + ) + print( + f"- selected: list of PhotoInfo objects for any photos selected in Photos (len={len(selected)})" ) print(f"\nThe following functions may be helpful:") print(f"- get_photo(uuid): return a PhotoInfo object for photo with uuid") @@ -4116,5 +4130,5 @@ def repl(ctx, cli_obj, db): print( f"- inspect(object): print information about an object; for example inspect(photosdb)" ) - print(f"- quit(): exit this interactive shell\n") + print(f"- q, quit, or quit(): exit this interactive shell\n") code.interact(banner="", local=locals())