|
@@ -0,0 +1,29 @@
|
|
|
+#!/usr/bin/env python3
|
|
|
+
|
|
|
+"""
|
|
|
+ranger/ext/rifle.py:
|
|
|
+> self.hook_before_executing(command, self._mimetype, self._app_flags)
|
|
|
+> try:
|
|
|
+> if 'r' in flags:
|
|
|
+> prefix = ['sudo', '-E', 'su', '-mc']
|
|
|
+> else:
|
|
|
+> prefix = ['/bin/sh', '-c']
|
|
|
+>
|
|
|
+> cmd = prefix + [command]
|
|
|
+> if 't' in flags:
|
|
|
+> # ...
|
|
|
+> cmd = [os.environ['TERMCMD'], '-e'] + cmd
|
|
|
+
|
|
|
+however termite expects the entire cmd as one single param
|
|
|
+"""
|
|
|
+
|
|
|
+import pipes
|
|
|
+import subprocess
|
|
|
+import sys
|
|
|
+
|
|
|
+assert sys.argv[1] == '-e', sys.argv
|
|
|
+
|
|
|
+subprocess.call([
|
|
|
+ 'termite',
|
|
|
+ '--exec={}'.format(' '.join(pipes.quote(p) for p in sys.argv[2:])),
|
|
|
+])
|