"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "plugins/.nmv" between
nnn-v4.3.tar.gz and nnn-v4.4.tar.gz

About: nnn is a full-featured terminal file manager.

.nmv  (nnn-v4.3):.nmv  (nnn-v4.4)
#!/usr/bin/env bash #!/usr/bin/env bash
# Description: An almost fully POSIX compliant batch file renamer # Description: An almost fully POSIX compliant batch file renamer
# #
# Note: nnn auto-detects and invokes this plugin if available # Note: nnn auto-detects and invokes this plugin if available
# Whitespace is used as delimiter for read. # Whitespace is used as delimiter for read.
# The plugin doesn't support filenames with leading or trailing whitespace # The plugin doesn't support filenames with leading or trailing whitespace
# To use NNN_LIST your shell must support readlink(1)
# #
# Capabilities: # Capabilities:
# 1. Basic file rename # 1. Basic file rename
# 2. Detects order change # 2. Detects order change
# 3. Can move files # 3. Can move files
# 4. Can remove files # 4. Can remove files
# 5. Switch number pairs to swap filenames # 5. Switch number pairs to swap filenames
# #
# Shell: bash # Shell: bash
# Author: KlzXS # Author: KlzXS
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}" VERBOSE="${VERBOSE:-0}"
RECURSIVE="${RECURSIVE:-0}"
selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection} selection=${NNN_SEL:-${XDG_CONFIG_HOME:-$HOME/.config}/nnn/.selection}
exit_status=0 exit_status=0
dst_file=$(mktemp "$TMPDIR/.nnnXXXXXX") dst_file=$(mktemp "$TMPDIR/.nnnXXXXXX")
if [ -s "$selection" ]; then if [ -s "$selection" ]; then
printf "Rename 'c'urrent / 's'election? " printf "Rename 'c'urrent / 's'election? "
read -r resp read -r resp
if ! [ "$resp" = "c" ] && ! [ "$resp" = "s" ]; then if ! [ "$resp" = "c" ] && ! [ "$resp" = "s" ]; then
exit 1 exit 1
fi fi
fi fi
if [ "$resp" = "s" ]; then if [ "$resp" = "s" ]; then
arr=$(tr '\0' '\n' < "$selection") arr=$(tr '\0' '\n' < "$selection")
else else
findcmd="find . ! -name ."
if [ "$RECURSIVE" -eq 0 ]; then
findcmd="$findcmd -prune"
fi
if [ "$INCLUDE_HIDDEN" -eq 0 ]; then if [ "$INCLUDE_HIDDEN" -eq 0 ]; then
arr=$(find . ! -name . -prune ! -name ".*" -print | sort) findcmd="$findcmd ! -name \".*\""
fi
if [ -z "$NNN_LIST" ]; then
findcmd="$findcmd -print"
else else
arr=$(find . ! -name . -prune -print | sort) findcmd="$findcmd -printf "'"'"$NNN_LIST/%P\n"'"'
fi fi
arr=$(eval "$findcmd" | sort)
fi fi
lines=$(printf "%s\n" "$arr" | wc -l) lines=$(printf "%s\n" "$arr" | wc -l)
width=${#lines} width=${#lines}
printf "%s" "$arr" | awk '{printf("%'"${width}"'d %s\n", NR, $0)}' > "$dst_file" printf "%s" "$arr" | awk '{printf("%'"${width}"'d %s\n", NR, $0)}' > "$dst_file"
items=("~") items=("~")
while IFS='' read -r line; do while IFS='' read -r line; do
if [ -n "$NNN_LIST" ]; then
line=$(readlink "$line" || printf "%s" "$line")
fi
items+=("$line"); items+=("$line");
done < <(printf "%s\n" "$arr") done < <(printf "%s\n" "$arr")
$EDITOR "$dst_file" $EDITOR "$dst_file"
while read -r num name; do while read -r num name; do
if [ -z "$name" ]; then if [ -z "$name" ]; then
if [ -z "$num" ]; then if [ -z "$num" ]; then
continue continue
fi fi
 End of changes. 7 change blocks. 
2 lines changed or deleted 20 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)