summary refs log tree commit diff stats
path: root/ranger.py
blob: 758fb5fb48387d3be4e7a7aaaa86e0274c3790ad (plain) (blame)
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
#!/usr/bin/python
# coding=utf-8
# ranger: Explore your forest of files from inside your terminal
#
# Copyright (c) 2009, 2010 hut <hut@lavabit.com>
#
# Permission to use, copy, modify, and/or distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
# WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
# MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
# ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
# WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
# ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
# OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
# ----------------------------------------------------------------------------
#
# An embedded shell script. It allows you to change the directory
# of the parent shell to the last visited directory in ranger after exit.
# For more information, check out doc/cd-after-exit.txt
# To enable this, start ranger with:
#     source /path/ranger /path/ranger
"""":
if [ $1 ]; then
	ranger_exec="$1"
	shift
	cd `exec $ranger_exec --cd-after-exit $@ 3>&1 1>&2 2>&3 3>&-`
	unset ranger_exec
else
	echo "usage: source path/to/ranger.py path/to/ranger.py"
fi
return 1
"""

# Redefine the docstring, since the previous one was hijacked to
# embed a shellscript.
__doc__ = """Ranger - file browser for the unix terminal"""


# Importing the main method may fail if the ranger directory
# is neither in the same directory as this file, nor in one of
# pythons global import paths.
try:
	from ranger import main

except ImportError as errormessage:
	import sys
	if '-d' not in sys.argv and '--debug' not in sys.argv:
		print("Can't import the main module.")
		print("To run an uninstalled copy of ranger,")
		print("launch ranger.py in the top directory.")
	else:
		raise

else:
	main()
an>: #000000; background-color: #c6c6c6; } a { color:inherit; } * { font-size:12pt; font-size: 1em; } .LineNr { } .Comment { color: #005faf; } .Constant { color: #008787; } .Special { color: #ff6060; } .Delimiter { color: #c000c0; } .PreProc { color: #c000c0; } --> </style> <script type='text/javascript'> <!-- /* function to open any folds containing a jumped-to line before jumping to it */ function JumpToLine() { var lineNum; lineNum = window.location.hash; lineNum = lineNum.substr(1); /* strip off '#' */ if (lineNum.indexOf('L') == -1) { lineNum = 'L'+lineNum; } var lineElem = document.getElementById(lineNum); /* Always jump to new location even if the line was hidden inside a fold, or * we corrected the raw number to a line ID. */ if (lineElem) { lineElem.scrollIntoView(true); } return true; } if ('onhashchange' in window) { window.onhashchange = JumpToLine; } --> </script> </head> <body onload='JumpToLine();'> <a href='https://github.com/akkartik/mu/blob/master/apps/ex1.mu'>https://github.com/akkartik/mu/blob/master/apps/ex1.mu</a> <pre id='vimCodeElement'> <span id="L1" class="LineNr"> 1 </span><span class="Comment"># First example: return the answer to the Ultimate Question of Life, the</span> <span id="L2" class="LineNr"> 2 </span><span class="Comment"># Universe, and Everything.</span> <span id="L3" class="LineNr"> 3 </span><span class="Comment">#</span> <span id="L4" class="LineNr"> 4 </span><span class="Comment"># To run:</span> <span id="L5" class="LineNr"> 5 </span><span class="Comment"># $ ./translate_mu apps/ex1.mu</span> <span id="L6" class="LineNr"> 6 </span><span class="Comment"># $ ./a.elf</span> <span id="L7" class="LineNr"> 7 </span><span class="Comment"># Expected result:</span> <span id="L8" class="LineNr"> 8 </span><span class="Comment"># $ echo $?</span> <span id="L9" class="LineNr"> 9 </span><span class="Comment"># 42</span> <span id="L10" class="LineNr">10 </span> <span id="L11" class="LineNr">11 </span><span class="PreProc">fn</span> main<span class="PreProc"> -&gt; </span>result/<span class="Constant">ebx</span>: int <span class="Delimiter">{</span> <span id="L12" class="LineNr">12 </span> result <span class="Special">&lt;-</span> copy <span class="Constant">0x2</span>a <span class="Comment"># Mu requires hexadecimal</span> <span id="L13" class="LineNr">13 </span><span class="Delimiter">}</span> </pre> </body> </html> <!-- vim: set foldmethod=manual : -->