#!/usr/bin/env python

import sys

from capn.hooks import handle_exit, handle_enter
from capn.util import expand

def call_handler():
    if len(sys.argv) != 4:
        return
    direction, old, new = sys.argv[1:4]
    if direction == 'exit':
        handle_exit(expand(old), expand(new))
    elif direction == 'enter':
        handle_enter(expand(old), expand(new))
    

if "__main__" == __name__:
    call_handler()
    
