Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

--post-function signature should return optional list of file paths #1136

Closed
3 tasks done
RhetTbull opened this issue Jul 26, 2023 · 3 comments
Closed
3 tasks done

--post-function signature should return optional list of file paths #1136

RhetTbull opened this issue Jul 26, 2023 · 3 comments
Labels
feature request New feature or request

Comments

@RhetTbull
Copy link
Owner

RhetTbull commented Jul 26, 2023

--post-function function signature should return an optional list of of files created or modified by the function. This would allow these files to be incorporated with --cleanup and --report.

  • update function signature
  • update ExportResults to add user_file and user_error
  • update example function & docs to show new fields for ExportResults

If signature was None | list[tuple[str, str]] then user function could return (filepath, error) for logging in the report alongside other errors.

Reference discussion:
If you're generating something that's not really a sidecar, like generating a GIF, a more elegant solution would be to update the --post-function function signature to return a list of files generated and these would be added to cleanup to keep and also added to reports as a user_file column. This could be done with backwards compatibility using:

# current signature
def post_function(
    photo: PhotoInfo, results: ExportResults, verbose: Callable, **kwargs
):
    ...

# new signature
def post_function(
    photo: PhotoInfo, results: ExportResults, verbose: Callable, **kwargs
) -> None | list[str]:
    ...

Originally posted by @RhetTbull in #1133 (reply in thread)

@RhetTbull RhetTbull added the feature request New feature or request label Jul 26, 2023
@RhetTbull
Copy link
Owner Author

Could also allow for return of an error string that could be logged and reported -> tuple[list[str], str | None] | None

@RhetTbull
Copy link
Owner Author

Completed in v0.62.0

@RhetTbull
Copy link
Owner Author

Implemented by allowing the user function to return ExportResults with new user_error and user_written, user_skipped fields.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature request New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant