Skip to content

Commit dc6d6dc

Browse files
committed
Add the -t/-T option to run pacdiff with --threeway
If pacdiff is run via `-p` (default), one can use `-t/-T` to respective enable/disable the `--threeway` option for it. Defaults to `-T` (disable). Closes #98
1 parent 00892ab commit dc6d6dc

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

admin/checkservices

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ fi
4747
AUTOCONFIRM=0 # autoconfirmation
4848
FAILED=1 # display failed service at the end
4949
PACDIFF=1 # run pacdiff
50+
THREEWAY=0 # run pacdiff with --threeway
5051
RELOAD=1 # reload systemd
5152
RESTART=1 # restart services
5253
SERIALIZE=0 # run in parallel
@@ -260,6 +261,7 @@ usage() {
260261
echo " -l/-L: call systemd daemon-(reload|reexec) (default: -l / $RELOAD)" >&2
261262
echo " -f/-F: display failed services before quit (default: -f / $FAILED)" >&2
262263
echo " -p/-P: call pacdiff before act (default: -p / $PACDIFF)" >&2
264+
echo " -t/-T: view diffs in 3-way fashion with pacdiff (default: -T / $THREEWAY)" >&2
263265
echo " -r/-R: restart services with updated files (default: -r / $RESTART)" >&2
264266
echo " -s/-S: display status of restarted service (default: -s / $STATUS)" >&2
265267
echo " -u/-U: act on services in users slice (default: -U / $USER_SLICE)" >&2
@@ -273,14 +275,15 @@ usage() {
273275
# set options as global vars
274276
argparse() {
275277
local opt
276-
while getopts 'AahFfLlPpRrSsUuMmZzi:' opt; do
278+
while getopts 'AahFfLlPpRrSsTtUuMmZzi:' opt; do
277279
case $opt in
278280
A) AUTOCONFIRM=0;; a) AUTOCONFIRM=1;;
279281
F) FAILED=0;; f) FAILED=1;;
280282
L) RELOAD=0;; l) RELOAD=1;;
281283
P) PACDIFF=0;; p) PACDIFF=1;;
282284
R) RESTART=0;; r) RESTART=1;;
283285
S) STATUS=0;; s) STATUS=1;;
286+
T) THREEWAY=0;; t) THREEWAY=1;;
284287
U) USER_SLICE=0;; u) USER_SLICE=1;;
285288
M) MACHINE_SLICE=0;; m) MACHINE_SLICE=1;;
286289
Z) SERIALIZE=0;; z) SERIALIZE=1;;
@@ -311,7 +314,11 @@ main() {
311314
# call pacdiff to ensure config files are updated before restart
312315
if (( PACDIFF )); then
313316
arrow 'Run pacdiff'
314-
pacdiff
317+
if (( THREEWAY )); then
318+
pacdiff --threeway
319+
else
320+
pacdiff
321+
fi
315322
fi
316323

317324
# ensure systemd has been reloaded or reexectued

0 commit comments

Comments
 (0)