Take the piece of cable with the nipple on it, feed it into the mech in the normal way as far as it will go. The nipple will stop it going right through.
Clamp the other end in the mech at the position where it will keep the chain in the chosen gear. Trim of any excess. The cable will only be attached to the mech.
Not tried it, but I think it should work. Note that it is still theoretically possible for the mech to move one way (down the gears, I think), so you could find it shifting to a lower gear if you hit some rough spots, but I think that would be unlikely.