summarylogtreecommitdiffstats
path: root/pacnews
blob: 8fd09890ce832b802a993429d4e6630b14f275c4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#!/usr/bin/bash -e

#
# pbrisbin 2013 (https://github.com/pbrisbin/scripts/blob/master/pacnews)
#
# Modified by Jesus Alvarez to use Neovim
#

if (( $UID )); then
  echo 'You must be root.' >&2
  exit 1
fi

shopt -s globstar nullglob

set -- "${1:-/etc}"/**/*.pacnew

(( $# )) || exit 1

for file; do
  current="${file/.pacnew/}"

  nvim -d "$current" "$file"

  rm -iv "$file" # -i gets us prompting for free
  [[ -f "$file" ]] && mv -iv "$file" "$current"
done