One-pot synthesis of pyrrole-2-carboxylates and -carboxamides via an electrocyclization/oxidation sequence.