summary refs log tree commit diff stats
diff options
context:
space:
mode:
authorhut <hut@lavabit.com>2010-06-09 13:11:06 +0200
committerhut <hut@lavabit.com>2010-06-09 13:11:06 +0200
commitaefd8048d2b246c0111ac1227ade2a9a9d38c35c (patch)
tree89e4b939878df48375def317c2225ba6cf917efd
parent57deeb86a73e527e7de3881cd5aa1488629695cf (diff)
downloadranger-aefd8048d2b246c0111ac1227ade2a9a9d38c35c.tar.gz
renamed "--fail-if-run" to the more accurate "--fail-unless-cd"
The old name, --fail-if-run, is still valid and working.
-rw-r--r--doc/ranger.16
-rwxr-xr-xranger.py2
-rw-r--r--ranger/__main__.py11
-rw-r--r--ranger/help/invocation.py9
4 files changed, 17 insertions, 11 deletions
diff --git a/doc/ranger.1 b/doc/ranger.1
index b197d774..39c33973 100644
--- a/doc/ranger.1
+++ b/doc/ranger.1
@@ -33,9 +33,9 @@ Activate the clean mode:  Ranger will not access or create any configuration
 files nor will it leave any traces on your system.  This is useful when
 your configuration is broken, when you want to avoid clutter, etc.
 .TP
---fail-if-run
+--fail-unless-cd
 Return the exit code 1 if ranger is used to run a file, for example with
-`ranger --fail-if-run filename`.  This can be useful for scripts.
+`ranger --fail-unless-cd filename`.  This can be useful for scripts.
 .TP
 -r \fIdir\fR, --confdir=\fIdir\fR
 Define a different configuration directory.  The default is $HOME/.ranger.
@@ -176,7 +176,7 @@ of your parent shell after exiting ranger:
 .nf
 
 ranger() {
-    command ranger --fail-if-run $@ &&
+    command ranger --fail-unless-cd $@ &&
     cd "$(grep \\^\\' ~/.ranger/bookmarks | cut -b3-)"
 }
 .\"-----------------------------------------
diff --git a/ranger.py b/ranger.py
index aca1b557..ccc9f0d6 100755
--- a/ranger.py
+++ b/ranger.py
@@ -23,7 +23,7 @@
 # after you exit ranger by starting it with: source ranger ranger
 """":
 if [ $1 ]; then
-	$@ --fail-if-run && cd "$(grep \^\' ~/.ranger/bookmarks | cut -b3-)"
+	$@ --fail-unless-cd && cd "$(grep \^\' ~/.ranger/bookmarks | cut -b3-)"
 else
 	echo "usage: source path/to/ranger.py path/to/ranger.py"
 fi
diff --git a/ranger/__main__.py b/ranger/__main__.py
index ff5cdc4d..a03509cf 100644
--- a/ranger/__main__.py
+++ b/ranger/__main__.py
@@ -26,7 +26,7 @@ import sys
 
 def parse_arguments():
 	"""Parse the program arguments"""
-	from optparse import OptionParser
+	from optparse import OptionParser, SUPPRESS_HELP
 	from ranger import __version__, USAGE, DEFAULT_CONFDIR
 	from ranger.ext.openstruct import OpenStruct
 	parser = OptionParser(usage=USAGE, version='ranger ' + __version__)
@@ -35,7 +35,9 @@ def parse_arguments():
 			help="activate debug mode")
 	parser.add_option('-c', '--clean', action='store_true',
 			help="don't touch/require any config files. ")
-	parser.add_option('--fail-if-run', action='store_true',
+	parser.add_option('--fail-if-run', action='store_true', # COMPAT
+			help=SUPPRESS_HELP)
+	parser.add_option('--fail-unless-cd', action='store_true',
 			help="experimental: return the exit code 1 if ranger is" \
 					"used to run a file (with `ranger filename`)")
 	parser.add_option('-r', '--confdir', type='string',
@@ -50,6 +52,9 @@ def parse_arguments():
 	options, positional = parser.parse_args()
 	arg = OpenStruct(options.__dict__, targets=positional)
 	arg.confdir = os.path.expanduser(arg.confdir)
+	if arg.fail_if_run:
+		arg.fail_unless_cd = arg.fail_if_run
+		del arg['fail_if_run']
 
 	return arg
 
@@ -185,7 +190,7 @@ def main():
 			runner = Runner(logfunc=print_function)
 			load_apps(runner, ranger.arg.clean)
 			runner(files=[File(target)], mode=arg.mode, flags=arg.flags)
-			sys.exit(1 if arg.fail_if_run else 0)
+			sys.exit(1 if arg.fail_unless_cd else 0)
 		else:
 			path = target
 	else:
diff --git a/ranger/help/invocation.py b/ranger/help/invocation.py
index 3de574cc..26cffd4a 100644
--- a/ranger/help/invocation.py
+++ b/ranger/help/invocation.py
@@ -43,9 +43,10 @@ command line.
       This is useful when your configuration is broken, when you want
       to avoid clutter, etc.
 
---fail-if-run
+--fail-unless-cd
       Return the exit code 1 if ranger is used to run a file, for example
-      with `ranger --fail-if-run filename`.  This can be useful for scripts.
+      with `ranger --fail-unless-cd filename`.  This can be useful for scripts.
+      (This option used to be called --fail-if-run)
 
 -r <dir>, --confdir=<dir>
       Define a different configuration directory.  The default is
@@ -69,7 +70,7 @@ command line.
 Examples:
       ranger episode1.avi
       ranger --debug /usr/bin
-      ranger --confdir=~/.config/ranger --fail-if-run
+      ranger --confdir=~/.config/ranger --fail-unless-cd
 
 
 ==============================================================================
@@ -95,7 +96,7 @@ docstrings.  Use this option if you don't need the documentation.
 Examples:
       PYTHONOPTIMIZE=1 ranger episode1.avi
       PYTHONOPTIMIZE=2 ranger --debug /usr/bin
-      python -OO `which ranger` --confdir=~/.config/ranger --fail-if-run
+      python -OO `which ranger` --confdir=~/.config/ranger --fail-unless-cd
 
 Note: The author expected "-OO" to reduce the memory usage, but that
 doesn't seem to happen.
ef='/akkartik/mu/commit/077trace_browser.cc?h=main&id=4243d710ed2a4a3d7881dae01879598a4fbcb5c7'>4243d710 ^
b1ce29dd ^
1725a858 ^
22d1a275 ^

b1ce29dd ^
1725a858 ^
22d1a275 ^

9463d417 ^
1725a858 ^
9463d417 ^


1725a858 ^
9463d417 ^


1725a858 ^
9463d417 ^

b1ce29dd ^
1725a858 ^
9463d417 ^
f22250a1 ^
9463d417 ^


b1ce29dd ^
1725a858 ^
63030ea7 ^
9463d417 ^

f3760b0f ^
9463d417 ^
9463d417 ^
4d03f69c ^
9463d417 ^

63030ea7 ^





f3760b0f ^
63030ea7 ^






293dbd7e ^
1725a858 ^
f3760b0f ^
b24eb476 ^

293dbd7e ^


f3760b0f ^
293dbd7e ^
293dbd7e ^


b24eb476 ^
293dbd7e ^



293dbd7e ^


293dbd7e ^

12f93e4a ^
1725a858 ^
f3760b0f ^
b24eb476 ^

ff1f5976 ^

12f93e4a ^
f3760b0f ^
12f93e4a ^
ff1f5976 ^
12f93e4a ^
b24eb476 ^
12f93e4a ^
ff1f5976 ^

12f93e4a ^


4243d710 ^



341239c9 ^

b24eb476 ^
341239c9 ^
4243d710 ^

f3760b0f ^
4243d710 ^



f22250a1 ^
341239c9 ^




b24eb476 ^
341239c9 ^
f3760b0f ^
f22250a1 ^
4243d710 ^

1164aefc ^
b24eb476 ^
1164aefc ^

777aae2e ^
1164aefc ^

4243d710 ^

4243d710 ^
22d1a275 ^
4243d710 ^







b24eb476 ^
f3760b0f ^

f22250a1 ^
1164aefc ^
f22250a1 ^
1164aefc ^

4243d710 ^
b24eb476 ^
1164aefc ^
4243d710 ^
1164aefc ^
4243d710 ^
1164aefc ^



4243d710 ^

10a3b8cc ^
4243d710 ^

8f249677 ^








bf458036 ^







8f249677 ^








bf458036 ^
8f249677 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
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