fixing the same increment/decrement problems as last checkin but this time for commands. also removing some code duplication
fixing the same increment/decrement problems as last checkin but this time for commands. also removing some code duplication

mozilla/gcli,joewalker/gcli,mozilla/gcli,joewalker/gcli,mozilla/gcli