From 7d387273ae2e994daaf988b9d4312ca1f7d75a79 Mon Sep 17 00:00:00 2001 From: Mario Domenech Goulart Date: Fri, 25 Apr 2014 10:43:28 -0300 Subject: scripts/get-maintainer: add --dump command line option --dump generates output in a format which is easier to parse. Columns are separated by TAB. Empty cells for the "Maintainer" column represent "no maintainer". Signed-off-by: Mario Domenech Goulart Signed-off-by: Otavio Salvador --- scripts/get-maintainer | 44 +++++++++++++++++++++++++++++++++----------- 1 file changed, 33 insertions(+), 11 deletions(-) (limited to 'scripts') diff --git a/scripts/get-maintainer b/scripts/get-maintainer index 5b82e35..9d1c0a6 100755 --- a/scripts/get-maintainer +++ b/scripts/get-maintainer @@ -31,15 +31,23 @@ Usage: --machine= Optional param to restrict the printing for a specific machine name. + --dump + Generate output in a format which is easier to parse. Columns + are separated by TAB. Empty cells for the "Maintainer" column + represent "no maintainer". + EOF } path= specific_machine= +dump_mode= for opt in ${*}; do if [ "`echo $opt | cut -b-10`" = "--machine=" ]; then specific_machine="`echo $opt | cut -b11-`" + elif [ "$opt" = "--dump" ]; then + dump_mode=1 else path="$path $opt" fi @@ -63,23 +71,37 @@ for m in $machines; do name=`sed -n 's,#@NAME:\s*\(.*\)\s*,\1,p' $m` maint=`sed -n 's,#@MAINTAINER:\s*\(.*\)\s*,\1,p' $m` - if [ -n "$maint" ]; then - printf "%-25s %-50s %-50s\n" "$machine" "$name" "$maint" >> $maintained - else - printf "%-25s %-50s %-50s\n" "$machine" "$name" "Orphan" >> $orphan - fi + if [ -n "$dump_mode" ]; then + if [ -n "$maint" ]; then + echo -e "${machine}\t${name}\t${maint}" >> $maintained + else + echo -e "${machine}\t${name}" >> $orphan + fi + else + if [ -n "$maint" ]; then + printf "%-25s %-50s %-50s\n" "$machine" "$name" "$maint" >> $maintained + else + printf "%-25s %-50s %-50s\n" "$machine" "$name" "Orphan" >> $orphan + fi + fi done -cat <