Sweeping-magnetic-twist mechanism for the acceleration of jets in the solar atmosphere