about summary refs log tree commit diff stats
path: root/ranger
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2011-08-23 01:24:51 +0200
committerhut <hut@lavabit.com>2011-08-23 01:24:51 +0200
commitb441d4b3147c9399d7452074297c2a10d7f899ba (patch)
treef8adb6824da63bd8ea6b976c981a5e6b917f6abf /ranger
parentc9fd11ac38ac6f4ded5a8b4c8b84c07546be0fb9 (diff)
downloadranger-b441d4b3147c9399d7452074297c2a10d7f899ba.tar.gz
defaults/keys: use = key for octal chmodding
Diffstat (limited to 'ranger')
-rw-r--r--ranger/defaults/keys.py14
1 files changed, 9 insertions, 5 deletions
diff --git a/ranger/defaults/keys.py b/ranger/defaults/keys.py
index e5f120cf..88d61ee4 100644
--- a/ranger/defaults/keys.py
+++ b/ranger/defaults/keys.py
@@ -196,19 +196,23 @@ map('ud', 'uy', fm.uncut())
 # ------------------------------------ changing of file permissions
 # type "+ow" for "chmod o+w %s" and so on
 from itertools import product
+octal_help    = 'Enter the octal mode number for chmod'
+symbolic_help = '%s %s to *r*ead, *w*rite, e*x*ecute'
 for mode in product('ugoa', 'rwxXst'):
 	map('-%s%s' % mode, fm.execute_console('shell chmod %s-%s %%s' % mode))
 	map('+%s%s' % mode, fm.execute_console('shell chmod %s+%s %%s' % mode))
-	map('=%s%s' % mode, fm.execute_console('shell chmod %s+%s %%s' % mode))
+for n in product(range(8), range(8), range(8)):
+	map('=%d%d%d' % n, fm.execute_console('shell chmod %d%d%d %%s' % n))
+	map('=%d<bg>'   %  n[0],        fm.hint(octal_help))
+	map('=%d%d<bg>' % (n[0], n[1]), fm.hint(octal_help))
 
 # hints:
-template = '%s %s to *r*ead, *w*rite, e*x*ecute'
 for who, name in zip('ugoa', ('user', 'group', 'others', 'all')):
-	map('-%s<bg>' % who, fm.hint(template % ('forbid', name)))
-	map('+%s<bg>' % who, fm.hint(template % ('allow', name)))
-	map('=%s<bg>' % who, fm.hint(template % ('allow', name)))
+	map('-%s<bg>' % who, fm.hint(symbolic_help % ('forbid', name)))
+	map('+%s<bg>' % who, fm.hint(symbolic_help % ('allow', name)))
 map('-<bg>', '+<bg>', '=<bg>', fm.hint('change permission for *u*ser, '
 	'*g*roup, *o*thers, *a*ll'))
+map('=<bg>', fm.hint(octal_help))
 
 # ---------------------------------------------------- run programs
 map('S', fm.execute_command(os.environ['SHELL']))