Move diff logic into cmd.