Added support for passing extra flags to cindex.

This includes refactoring the existing cindex-based commands to use a
common implementation.