[RFC/PATCH 2/4] replace: use OPT_CMDMODE to handle modes

2014-03-06 Thread Jeff King
By using OPT_CMDMODE, the mutual exclusion between modes is taken care of for us. It also makes it easy for us to maintain a single variable with the mode, which makes its intent more clear. We can use a single switch() to make sure we have covered all of the modes. This ends up breaking even in

Re: [RFC/PATCH 2/4] replace: use OPT_CMDMODE to handle modes

2014-03-06 Thread Jeff King
On Thu, Mar 06, 2014 at 07:35:19PM +0100, Christian Couder wrote: + if (!cmdmode) + cmdmode = argc ? MODE_REPLACE : MODE_DELETE; Shouldn't it be MODE_LIST instead of MODE_DELETE? Argh, yes, thank you for catching. My original iteration used chars like 'd' and 'l'