mirror of
https://github.com/Ascyii/scripts.git
synced 2026-01-01 12:54:24 -05:00
38 lines
884 B
Bash
Executable File
38 lines
884 B
Bash
Executable File
#!/bin/sh
|
|
|
|
OLD="$1"
|
|
NEW="$2"
|
|
MERGED="$3" # Optional
|
|
BASE="$4" # Optional
|
|
|
|
#shift 4 # Shift all four known arguments
|
|
PATHS="$@" # Everything left are additional paths/options
|
|
|
|
# Quoting and checking empty variables safely
|
|
if [ -d "$OLD" ]; then
|
|
# Directory diff
|
|
nvim -d -c "DiffviewFileHistory"
|
|
if [ -z "$PATHS" ]; then
|
|
# nvim -d "$OLD" "$NEW" -c "DiffviewFileHistory"
|
|
echo "starting diff view wrapper with no paths"
|
|
|
|
else
|
|
#nvim -d "$OLD" "$NEW" -c "DiffviewFileHistory $PATHS"
|
|
echo "starting diff view wrapper with paths"
|
|
fi
|
|
else
|
|
# File diff
|
|
if [ -z "$MERGED" ]; then
|
|
nvim -d "$OLD" "$NEW"
|
|
else
|
|
nvim -d -c "DiffviewOpen"
|
|
if [ -z "$PATHS" ]; then
|
|
#nvim -d "$OLD" "$NEW" -c "DiffviewOpen"
|
|
echo "starting diff view wrapper with no paths"
|
|
else
|
|
#nvim -d "$OLD" "$NEW" -c "DiffviewOpen $PATHS"
|
|
echo "starting diff view wrapper with paths"
|
|
fi
|
|
fi
|
|
fi
|