mirror of
https://github.com/jarun/nnn.git
synced 2024-11-28 05:41:31 +00:00
Add verbose option (#497)
This commit is contained in:
parent
5e8f0aec35
commit
aab90bf515
|
@ -17,6 +17,7 @@
|
||||||
EDITOR="${EDITOR:-vi}"
|
EDITOR="${EDITOR:-vi}"
|
||||||
TMPDIR="${TMPDIR:-/tmp}"
|
TMPDIR="${TMPDIR:-/tmp}"
|
||||||
INCLUDE_HIDDEN="${INCLUDE_HIDDEN:-0}"
|
INCLUDE_HIDDEN="${INCLUDE_HIDDEN:-0}"
|
||||||
|
VERBOSE="${VERBOSE:-0}"
|
||||||
|
|
||||||
selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
|
selection=${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection
|
||||||
exit_status=0
|
exit_status=0
|
||||||
|
@ -95,7 +96,9 @@ while read -r num name; do
|
||||||
done
|
done
|
||||||
|
|
||||||
if mv "$name" "$tmp"; then
|
if mv "$name" "$tmp"; then
|
||||||
|
if [ "$VERBOSE" -ne 0 ]; then
|
||||||
printf "'%s' -> '%s'\n" "$name" "$tmp"
|
printf "'%s' -> '%s'\n" "$name" "$tmp"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
printf "%s: failed to rename %s to %s: %s\n" "$0" "$name" "$tmp" "$!" > /dev/stderr
|
printf "%s: failed to rename %s to %s: %s\n" "$0" "$name" "$tmp" "$!" > /dev/stderr
|
||||||
exit_status=1
|
exit_status=1
|
||||||
|
@ -121,12 +124,17 @@ while read -r num name; do
|
||||||
items[$key]=$(printf "%s" "${items[$key]}" | sed "s|^$src\(\$\|\/\)|$name\1|")
|
items[$key]=$(printf "%s" "${items[$key]}" | sed "s|^$src\(\$\|\/\)|$name\1|")
|
||||||
done
|
done
|
||||||
|
|
||||||
|
if [ "$VERBOSE" -ne 0 ]; then
|
||||||
printf "'%s' => '%s'\n" "$src" "$name"
|
printf "'%s' => '%s'\n" "$src" "$name"
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
|
true
|
||||||
|
if [ "$VERBOSE" -ne 0 ]; then
|
||||||
printf "'%s' -> '%s'\n" "$src" "$name"
|
printf "'%s' -> '%s'\n" "$src" "$name"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
unset "items[$num]"
|
unset "items[$num]"
|
||||||
done <"$dst_file"
|
done <"$dst_file"
|
||||||
|
|
Loading…
Reference in a new issue