when-command icon indicating copy to clipboard operation
when-command copied to clipboard

Pass data to tasks

Open almostearthling opened this issue 8 years ago • 1 comments

Apart from plain time-based events, most events (and thus satisfied conditions) carry important or at least interesting information that could be exploited by tasks to modify their behavior. There should be the option to access this data for commands that are run by tasks. The most likely implementation is an environment variable, let's call it WHEN_COMMAND_DATA, that carries a documented, JSON-formatted aggregate containing all data that comes with the event. It's then up to the user to interpret such data with appropriate tools, such as jq or similar utilities. Data is differently structured in different events, so the relatively free (and relatively standard) JSON form is probably the best option.

The implementation should not modify the internal format of the main When objects to avoid compatibility breaks.

almostearthling avatar May 31 '16 10:05 almostearthling

A problem can occur when multiple events trigger the same task set: since in that case further occurrences of the same event are discarded, some data could be lost.

almostearthling avatar May 31 '16 10:05 almostearthling

More related to whenever than to when at the moment: closing it.

almostearthling avatar Jun 27 '24 21:06 almostearthling