Skip to content

Commit

Permalink
add some newlines between files for spacing and readability
Browse files Browse the repository at this point in the history
  • Loading branch information
paulirish committed Feb 26, 2016
1 parent 652032a commit dd26e6b
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion diff-so-fancy
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ git_index_line_pattern="^($color_code_regex)index .*"

format_diff_header () {
# simplify the unified patch diff header
$SED -E "/^($color_code_regex)diff --git .*$/d" \
$SED -E "s/^($color_code_regex)diff --git .*$//g" \
| $SED -E "/$git_index_line_pattern/{N;s/$git_index_line_pattern\n//;}" \
| $SED -E "s/^($color_code_regex)\-\-\-(.*)$/\1$(print_horizontal_rule)\\${NL}\1\-\-\-\-\5/g" \
| $SED -E "s/^($color_code_regex)\+\+\+(.*)$/\1\+\+\+\+\5\\${NL}\1$(print_horizontal_rule)/g"
Expand All @@ -53,6 +53,10 @@ mark_empty_lines () {
$SED -E "s/^$color_code_regex[\+\-]$reset_color\s*$/$invert_color\1 $reset_escape/g"
}

remove_first_empty_line () {
$SED -E '1 D'
}

strip_leading_symbols () {
# strip the + and -
$SED -E "s/^($color_code_regex)[\+\-]/\1 /g"
Expand All @@ -73,5 +77,6 @@ cat $input \
| format_diff_header \
| colorize_context_line \
| mark_empty_lines \
| remove_first_empty_line \
| strip_leading_symbols \
| strip_first_column

0 comments on commit dd26e6b

Please sign in to comment.