Skip to content

Feature Request: Scriptable User Defined Behavior #6

@lukasmwerner

Description

@lukasmwerner

When I save a recipe I would like to automatically save that to my recipe server. If there was a way to do different actions based on certain triggers / criteria it would enable the ability to do that. It would also allow for other workflows and further enhance the user's ability to modify the program.

The current API I've been thinking of is something similar to the dynamicland scripting language. The language would be lua as that is the language that I have the most experience in implementing into golang programs. Another language I'm considering is tengo as it looks easy enough to write and integrate.

task.desc 'Upload & print recipe'
-- each string is a sql query match
task.matches { 'tags:recipe', 'https://cooking.nytimes.com/', 'https://www.americastestkitchen.com/' } 
-- actual behavior when a query matches
task.action = function (bookmark)
    ...
end

Each task would be a lua file in the config folder that defines what each task does.

.config/mark/
  |-> changes/
  |-> crsqlite.{dylib|so}
  |-> data.db
  |-> tasks/
       |-> recipe.lua
       |-> link_blog.lua

Some useful APIs would be:

  • HTTP - Making outbound requests
    • get, post, etc
  • JSON - For web APIs etc
    • encode & decode
  • DB - Being able to query and act on the database's data.
    • query, execute

Tasks should only run after insert. In order to run a task over all the data, leave out its matches definition and run mark run <task_file_name> e.g. mark run recipe.lua. The execution lookup order for this will be current working directory, and then the global tasks folder.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions