--functions can take filenames, can be used multiple times #681
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Claude Code: https://gistpreview.github.io/?37fe8d2b19231e8ed5ef2967e1ba757b
Closes:
The
--functionsoption now supports:File paths: Pass a
.pyfile containing function definitionssqlite-utils query db.db "select domain(url) from urls" --functions funcs.pyMultiple invocations: Use
--functionsmultiple times to load from different sourcesInline code: Existing behavior still works
Implementation
Follows the same pattern as LLM's
--functionsflag (simonw/llm@a880c123):.pyextensionpathlib.Path().read_text()multiple=TrueChanges
multiple=Trueto--functionsClick option inquery,bulk, andmemorycommands_register_functions()to detect and read.pyfiles_maybe_register_functions()to iterate over multiple function sourcesAll tests pass including new test coverage for:
.pyfiles--functionsmultiple times📚 Documentation preview 📚: https://sqlite-utils--681.org.readthedocs.build/en/681/