Restore erroneously deleted method

This method was deleted in 4261eee0 but we still need it for the !cd
commands.