Extract hooks from command