summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2013-02-05 04:08:38 +0100
committerhut <hut@lavabit.com>2013-02-05 04:08:38 +0100
commit5036975750fb3447f5a060bf1523773eb25d3313 (patch)
treedd273ecd9df97792defd5d118c5dde99b6a7124f /ranger
parentaa6cc7a69c5eb9300f9f9ce31a04998be1dab0f1 (diff)
downloadranger-5036975750fb3447f5a060bf1523773eb25d3313.tar.gz
added tab completion for open_with
Diffstat (limited to 'ranger')
-rw-r--r--ranger/api/commands.py11
-rw-r--r--ranger/config/commands.py3
2 files changed, 14 insertions, 0 deletions
diff --git a/ranger/api/commands.py b/ranger/api/commands.py
index 8e7e16ac..4a9688a0 100644
--- a/ranger/api/commands.py
+++ b/ranger/api/commands.py
@@ -271,6 +271,17 @@ class Command(FileManagerAware):
 			# manually type in the slash to advance into that directory
 			return (self.start(1) + join(rel_dirname, name) for name in names)
 
+	def _tab_through_executables(self):
+		from ranger.ext.get_executables import get_executables
+		programs = [program for program in get_executables() if \
+				program.startswith(self.rest(1))]
+		if not programs:
+			return
+		if len(programs) == 1:
+			return self.start(1) + programs[0]
+		programs.sort()
+		return (self.start(1) + program for program in programs)
+
 
 class FunctionCommand(Command):
 	_based_function = None
diff --git a/ranger/config/commands.py b/ranger/config/commands.py
index bc6e674c..74d306e8 100644
--- a/ranger/config/commands.py
+++ b/ranger/config/commands.py
@@ -243,6 +243,9 @@ class open_with(Command):
 				flags = flags,
 				mode = mode)
 
+	def tab(self):
+		return self._tab_through_executables()
+
 	def _get_app_flags_mode(self, string):
 		"""
 		Extracts the application, flags and mode from a string.
187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250