summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lepus.uberspace.de>2015-04-09 16:26:46 +0200
committerhut <hut@lepus.uberspace.de>2015-04-09 16:26:46 +0200
commit92ee32581a8841c4a843ad1d644818a0c20a1f1a (patch)
tree7a25dfbc4eca23cbd8fe37e7aeded333fe7185d1 /ranger
parent453a282ed0d599174cc8f45ed13c54b1be1ea4f6 (diff)
parent1b5c7bd54ac76a3e62a28762402b4db2df5d9e2a (diff)
downloadranger-92ee32581a8841c4a843ad1d644818a0c20a1f1a.tar.gz
Merge branch 'linemode_api' of git://github.com/Vifon/ranger
Diffstat (limited to 'ranger')
-rw-r--r--ranger/config/rc.conf1
-rw-r--r--ranger/container/fsobject.py2
-rw-r--r--ranger/core/linemode.py15
3 files changed, 17 insertions, 1 deletions
diff --git a/ranger/config/rc.conf b/ranger/config/rc.conf
index ca67c389..62dd030f 100644
--- a/ranger/config/rc.conf
+++ b/ranger/config/rc.conf
@@ -251,6 +251,7 @@ map cd console cd
 
 # Change the line mode
 map Mf linemode filename
+map Mi linemode fileinfo
 map Mp linemode permissions
 map Mt linemode metatitle
 
diff --git a/ranger/container/fsobject.py b/ranger/container/fsobject.py
index 131e2304..1bf08e20 100644
--- a/ranger/container/fsobject.py
+++ b/ranger/container/fsobject.py
@@ -86,7 +86,7 @@ class FileSystemObject(FileManagerAware, SettingsAware):
     _linemode = DEFAULT_LINEMODE
     linemode_dict = dict(
         (linemode.name, linemode()) for linemode in
-        [DefaultLinemode, TitleLinemode, PermissionsLinemode]
+        [DefaultLinemode, TitleLinemode, PermissionsLinemode, FileInfoLinemode]
     )
 
     def __init__(self, path, preload=None, path_is_abs=False, basename_is_rel_to=None):
diff --git a/ranger/core/linemode.py b/ranger/core/linemode.py
index 7993af82..529c6b93 100644
--- a/ranger/core/linemode.py
+++ b/ranger/core/linemode.py
@@ -84,3 +84,18 @@ class PermissionsLinemode(LinemodeBase):
 
     def infostring(self, file, metadata):
         return ""
+
+
+class FileInfoLinemode(LinemodeBase):
+    name = "fileinfo"
+
+    def filetitle(self, file, metadata):
+        return file.relative_path
+
+    def infostring(self, file, metadata):
+        if not file.is_directory:
+            from subprocess import check_output
+            fileinfo = check_output(["file", "-bL", file.path]).strip()
+            return fileinfo
+        else:
+            raise NotImplementedError