How can a Bluetooth keyboard that requires a code entry be paired in the terminal?

I have a Bluetooth ThinkPad 2 Tablet keyboard that I want to pair with my Ubuntu Touch Aquaris E4.5. Due to GUI limitations, I want to try to do this in the terminal. I'm hoping that the process'll...