Seeting up bluetooth/a wiimote without a GUI

I can connect to the wiimote with wminput, but I'd like to set up
something that does not need a GUI: typically, I put the wiimote in
discovery mode (1+2), then I start a script that establishes the
connection and keeps it alive until I disconnect the mote with another
command.

I've tried to connect with hcitool too, but haven't found a viable
solution yes.

Anybody can help with this, or with bluetooth settings and tools in
general?