Cli - Command line tool watcher-fs

watcher_fs.cli.create_actions_callback(actions_list: List[str | Dict]) callable

Create a callback function that dynamically loads and executes action functions from actions_list.

Parameters:

actions_list – List of actions, each a string or dict with ‘action’ key and other params.

Returns:

A callback function that takes a ‘changes’ parameter and executes all action functions.

watcher_fs.cli.load_action_function(action_name: str, kwargs: Dict = None) callable

Load the ‘action’ function from a module, optionally binding kwargs with partial.

watcher_fs.cli.load_config(config_path='watcher-fs.cfg')

Load configuration from a JSON file.

watcher_fs.cli.register_watcher_callback(config: dict, index=0)

Register a single path - trigger_type - actions definition to Watcher

Parameters:
  • config – Dict specification of what to register into Watcher instance. Contains keys: path, trigger_type, actions

  • index – Int index of the definition read from file configuration