Browse Source

dev tools: Stage the copyright block to make diffs smaller.

pull/371/head
Daniel Shahaf 8 years ago
parent
commit
5627fd2045
1 changed files with 9 additions and 11 deletions
  1. +9
    -11
      tests/generate.zsh

+ 9
- 11
tests/generate.zsh View File

@ -41,9 +41,6 @@ fi
buffer=$1 buffer=$1
ZSH_HIGHLIGHT_HIGHLIGHTERS=( $2 ) ZSH_HIGHLIGHT_HIGHLIGHTERS=( $2 )
fname=${0:A:h:h}/highlighters/$2/test-data/${3%.zsh}.zsh fname=${0:A:h:h}/highlighters/$2/test-data/${3%.zsh}.zsh
exec 3>&1
exec >$fname
git add -N $fname
# Load the main script. # Load the main script.
. ${0:A:h:h}/zsh-syntax-highlighting.zsh . ${0:A:h:h}/zsh-syntax-highlighting.zsh
@ -54,9 +51,17 @@ _zsh_highlight_add_highlight()
region_highlight+=("$1 $2 $3") region_highlight+=("$1 $2 $3")
} }
# Copyright block # Copyright block
<$0 sed -n -e '1,/^$/p' | sed -e 's/2[0-9][0-9][0-9]/YYYY/'
year="`LC_ALL=C date +%Y`"
if ! read -q "?Set copyright year to $year? "; then
year="YYYY"
fi
exec >$fname
<$0 sed -n -e '1,/^$/p' | sed -e "s/2[0-9][0-9][0-9]/${year}/"
echo "" echo ""
# Assumes stdout is line-buffered
git add -- $fname
# Buffer # Buffer
print -n 'BUFFER=' print -n 'BUFFER='
@ -87,10 +92,3 @@ print 'expected_region_highlight=('
done done
} }
print ')' print ')'
exec >&3
year="`LC_ALL=C date +%Y`"
if read -q "?Set copyright year to $year? "; then
<$fname >$fname.t sed s/YYYY/$year/ &&
mv $fname.t $fname
fi

Loading…
Cancel
Save