mirror of
https://github.com/Ascyii/scripts.git
synced 2026-01-01 04:44:24 -05:00
Init
This commit is contained in:
37
shell/diffv_wrap.sh
Executable file
37
shell/diffv_wrap.sh
Executable file
@@ -0,0 +1,37 @@
|
||||
#!/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
|
||||
Reference in New Issue
Block a user