summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-04-12 15:11:34 +0200
committerhut <hut@lepus.uberspace.de>2015-04-12 15:11:34 +0200
commit80d517985a0525ffc4b3a1343f67c7d7e63d6c76 (patch)
tree7dadc198b3abeff1e127a745c42886845f4e7a5b
parentaf17ede9ff216d09495672e00a36ba60fbf8bee3 (diff)
downloadranger-80d517985a0525ffc4b3a1343f67c7d7e63d6c76.tar.gz
config/commands.py: deduplication
-rw-r--r--ranger/config/commands.py9
1 files changed, 4 insertions, 5 deletions
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index 6b36350b..93254350 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -850,13 +850,12 @@ class bulkrename(Command):
         cmdfile = tempfile.NamedTemporaryFile()
         cmdfile.write(b"# This file will be executed when you close the editor.\n")
         cmdfile.write(b"# Please double-check everything, clear the file to abort.\n")
+        content = "\n".join("mv -vi -- " + esc(old) + " " + esc(new) \
+                for old, new in zip(filenames, new_filenames) if old != new)
         if py3:
-            cmdfile.write("\n".join("mv -vi -- " + esc(old) + " " + esc(new) \
-                for old, new in zip(filenames, new_filenames) \
-                if old != new).encode("utf-8"))
+            cmdfile.write(content.encode("utf-8"))
         else:
-            cmdfile.write("\n".join("mv -vi -- " + esc(old) + " " + esc(new) \
-                for old, new in zip(filenames, new_filenames) if old != new))
+            cmdfile.write(content)
         cmdfile.flush()
 
         # Open the script and let the user review it, then check if the script