Capn uses a simple YAML file for specifying paths and their hooks. As a quick example, consider the following:
settings: default_type: path external_hooks: - ~/.otherhooks hooks: - path: /home type: tree enter: - echo entering /home exit: - echo exiting /home - echo /home waves goodbye - path: ~/ enter: - echo entering ~/ exit: - echo exiting ~/
The above establish enter and exit hooks for the two listed directories. As you change directories you should see output indicating each hook's execution. You'll notice that the /home path has a type key with the value tree. There are two types of hooks; path, which is the default, only triggers for that absolute path. tree hooks will trigger when you enter or leave the tree below the specified path. Moving between child-paths below the tree does not trigger the hooks. For example, moving from / -> /home would trigger the enter hook. Moving from /home -> ~/ would not trigger the exit hook.