DRY a little from-endpoint command loop code