From b4bd04c1461d0b427937f541403305bc979bcf4f Mon Sep 17 00:00:00 2001 From: Rhet Turnbull Date: Sun, 23 Jan 2022 18:38:11 -0800 Subject: [PATCH] Added run command, #598 --- README.md | 4 ++-- docs/.buildinfo | 2 +- docs/_static/documentation_options.js | 2 +- docs/cli.html | 2 +- docs/genindex.html | 2 +- docs/index.html | 2 +- docs/modules.html | 2 +- docs/reference.html | 2 +- docs/search.html | 2 +- osxphotos/cli.py | 9 ++++++++- 10 files changed, 18 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 0f40c924..d73f336c 100644 --- a/README.md +++ b/README.md @@ -1723,7 +1723,7 @@ Substitution Description {lf} A line feed: '\n', alias for {newline} {cr} A carriage return: '\r' {crlf} a carriage return + line feed: '\r\n' -{osxphotos_version} The osxphotos version, e.g. '0.44.11' +{osxphotos_version} The osxphotos version, e.g. '0.44.12' {osxphotos_cmd_line} The full command line used to run osxphotos The following substitutions may result in multiple values. Thus if specified for @@ -3627,7 +3627,7 @@ The following template field substitutions are availabe for use the templating s |{lf}|A line feed: '\n', alias for {newline}| |{cr}|A carriage return: '\r'| |{crlf}|a carriage return + line feed: '\r\n'| -|{osxphotos_version}|The osxphotos version, e.g. '0.44.11'| +|{osxphotos_version}|The osxphotos version, e.g. '0.44.12'| |{osxphotos_cmd_line}|The full command line used to run osxphotos| |{album}|Album(s) photo is contained in| |{folder_album}|Folder path + album photo is contained in. e.g. 'Folder/Subfolder/Album' or just 'Album' if no enclosing folder| diff --git a/docs/.buildinfo b/docs/.buildinfo index 3a3c1e24..7dcc9c91 100644 --- a/docs/.buildinfo +++ b/docs/.buildinfo @@ -1,4 +1,4 @@ # Sphinx build info version 1 # This file hashes the configuration used when building these files. When it is not found, a full rebuild will be done. -config: dbae0cb30116fdf5326586184a4e5e1e +config: 2b46ed6fff6c9124ce0554461f401ffd tags: 645f666f9bcd5a90fca523b33c5a78b7 diff --git a/docs/_static/documentation_options.js b/docs/_static/documentation_options.js index a0a02e83..0df9e80c 100644 --- a/docs/_static/documentation_options.js +++ b/docs/_static/documentation_options.js @@ -1,6 +1,6 @@ var DOCUMENTATION_OPTIONS = { URL_ROOT: document.getElementById("documentation_options").getAttribute('data-url_root'), - VERSION: '0.44.11', + VERSION: '0.44.12', LANGUAGE: 'None', COLLAPSE_INDEX: false, BUILDER: 'html', diff --git a/docs/cli.html b/docs/cli.html index 9c7104a7..4c79041e 100644 --- a/docs/cli.html +++ b/docs/cli.html @@ -6,7 +6,7 @@ - osxphotos command line interface (CLI) — osxphotos 0.44.11 documentation + osxphotos command line interface (CLI) — osxphotos 0.44.12 documentation diff --git a/docs/genindex.html b/docs/genindex.html index dbb37918..aa738e9e 100644 --- a/docs/genindex.html +++ b/docs/genindex.html @@ -5,7 +5,7 @@ - Index — osxphotos 0.44.11 documentation + Index — osxphotos 0.44.12 documentation diff --git a/docs/index.html b/docs/index.html index a5c71755..8bfee4f5 100644 --- a/docs/index.html +++ b/docs/index.html @@ -6,7 +6,7 @@ - Welcome to osxphotos’s documentation! — osxphotos 0.44.11 documentation + Welcome to osxphotos’s documentation! — osxphotos 0.44.12 documentation diff --git a/docs/modules.html b/docs/modules.html index ed144f32..a6a66725 100644 --- a/docs/modules.html +++ b/docs/modules.html @@ -6,7 +6,7 @@ - osxphotos — osxphotos 0.44.11 documentation + osxphotos — osxphotos 0.44.12 documentation diff --git a/docs/reference.html b/docs/reference.html index 7574e1a3..0a6ad535 100644 --- a/docs/reference.html +++ b/docs/reference.html @@ -6,7 +6,7 @@ - osxphotos package — osxphotos 0.44.11 documentation + osxphotos package — osxphotos 0.44.12 documentation diff --git a/docs/search.html b/docs/search.html index bd004b38..6dc235d8 100644 --- a/docs/search.html +++ b/docs/search.html @@ -5,7 +5,7 @@ - Search — osxphotos 0.44.11 documentation + Search — osxphotos 0.44.12 documentation diff --git a/osxphotos/cli.py b/osxphotos/cli.py index de283c16..02c92cc7 100644 --- a/osxphotos/cli.py +++ b/osxphotos/cli.py @@ -17,7 +17,7 @@ import shutil import subprocess import sys import time -from runpy import run_module +from runpy import run_module, run_path from typing import Dict import bitmath @@ -4616,3 +4616,10 @@ def diff(ctx, cli_obj, db, raw_output, style, db2, verbose): line, "sql", theme=style, line_numbers=False, code_width=1000 ) console.print(syntax) + + +@cli.command(name="run") +@click.argument("python_file", nargs=1, type=click.Path(exists=True)) +def run(python_file): + """Run a python file using same environment as osxphotos""" + run_path(python_file, run_name="__main__")