Hi, I've recently setup mutt with a gmail account to sent patches to gcc-patches, and realized it would be convenient to add the email addresses in the MAINTAINERS file to the mutt address book.
I've written this script, that in normal mode generates the <name, email address> info in csv format: ... Aaron Sawdey, acsaw...@linux.ibm.com Aaron W. LaFramboise, aaronava...@aaronwl.com ... Zdenek Dvorak, o...@ucw.cz Ziga Mahkovec, ziga.mahko...@klika.si ... and in --mutt mode generates mutt aliases: ... alias Aaron_Sawdey Aaron Sawdey <acsaw...@linux.ibm.com> alias Aaron_W_LaFramboise Aaron W. LaFramboise <aaronava...@aaronwl.com> ... alias Zdenek_Dvorak Zdenek Dvorak <o...@ucw.cz> alias Ziga_Mahkovec Ziga Mahkovec <ziga.mahko...@klika.si> ... Good or bad idea? Any other comments? OK for trunk? Thanks, - Tom Add contrib/generate-from-maintainers.sh 2018-05-30 Tom de Vries <t...@codesourcery.com> * generate-from-maintainers.sh: New file. --- contrib/generate-from-maintainers.sh | 45 ++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/contrib/generate-from-maintainers.sh b/contrib/generate-from-maintainers.sh new file mode 100755 index 0000000..c9b3a94 --- /dev/null +++ b/contrib/generate-from-maintainers.sh @@ -0,0 +1,45 @@ +#! /bin/sh +# +# Generate structured information from MAINTAINERS file +# +# Copyright (C) 2018 Free Software Foundation, Inc. +# +# This script is Free Software, and it can be copied, distributed and +# modified as defined in the GNU General Public License. A copy of +# its license can be downloaded from http://www.gnu.org/copyleft/gpl.html +# +# Run without argument to generate csv file containing names and email addresses. +# +# Run with --mutt argument to generate mutt alias file, f.i. +# $ ./contrib/generate-from-maintainers.sh --mutt >> ~/.muttrc + +if [ "$1" = "--mutt" ]; then + fmt=" +{ + alias=name + gsub(/ /, \"_\", alias) + gsub(/[.]/, \"\", alias) + printf \"alias %s %s <%s>\n\", alias, name, email +} +" +else + fmt="{ printf \"%s, %s\n\", name, email }" +fi + +grep @ ./MAINTAINERS \ + | sed 's/[\t][\t]*/\t/g' \ + | awk -F '\t' \ + " +{ + if (NF == 2) { + name=\$1 + email=\$2 + } else if (NF == 3 ) { + name=\$2 + email=\$3 + } + gsub(/</,\"\", email) + gsub(/>/,\"\", email) + $fmt +}" \ + | sort -u