.\" Automatically generated by Pod::Man 2.28 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "RANGER 1" .TH RANGER 1 "ranger-1.6.1" "08/26/2014" "ranger manual" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" ranger \- visual file manager .SH "SYNOPSIS" .IX Header "SYNOPSIS" \&\fBranger\fR [\fB\-\-version\fR] [\fB\-\-help\fR] [\fB\-\-debug\fR] [\fB\-\-clean\fR] [\fB\-\-confdir\fR=\fIdirectory\fR] [\fB\-\-copy\-config\fR=\fIwhich\fR] [\fB\-\-choosefile\fR=\fItarget\fR] [\fB\-\-choosefiles\fR=\fItarget\fR] [\fB\-\-choosedir\fR=\fItarget\fR] [\fB\-\-selectfile\fR=\fIfilepath\fR] [\fB\-\-list\-unused\-keys\fR] [\fB\-\-list\-tagged\-files\fR=\fItag\fR] [\fB\-\-profile\fR] [\fB\-\-cmd\fR=\fIcommand\fR] [\fIpath\fR] .SH "DESCRIPTION" .IX Header "DESCRIPTION" ranger is a console file manager with \s-1VI\s0 key bindings. .SH "RESOURCES" .IX Header "RESOURCES" \&\fIThis manual\fR contains instructions on how to use and configure ranger. .PP \&\fIInside ranger\fR, you can press \fI1?\fR for a list of key bindings, \fI2?\fR for commands and \fI3?\fR for settings. .PP The \fI\s-1README\s0\fR contains install instructions. .PP The file \fIdoc/HACKING\fR contains guidelines for code modification. .PP The directory \fIdoc/configs\fR contains configuration files. They are usually installed to \fI/usr/lib/python*/site\-packages/ranger/config\fR and can be obtained with ranger's \-\-copy\-config option. .PP The man page of \fIrifle\fR\|(1) describes the functions of the file opener .PP The section \fI\s-1LINKS\s0\fR of this man page contains further resources. .SH "OPTIONS" .IX Header "OPTIONS" .IP "\fB\-d\fR, \fB\-\-debug\fR" 14 .IX Item "-d, --debug" Activate the debug mode: Whenever an error occurs, ranger will exit and print a full traceback. The default behavior is to merely print the name of the exception in the statusbar/log and try to keep running. .IP "\fB\-c\fR, \fB\-\-clean\fR" 14 .IX Item "-c, --clean" 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. .IP "\fB\-r\fR \fIdir\fR, \fB\-\-confdir\fR=\fIdir\fR" 14 .IX Item "-r dir, --confdir=dir" Change the configuration directory of ranger from ~/.config/ranger to \*(L"dir\*(R". .IP "\fB\-\-copy\-config\fR=\fIfile\fR" 14 .IX Item "--copy-config=file" Create copies of the default configuration files in your local configuration directory. Existing ones will not be overwritten. Possible values: \fIall\fR, \&\fIcommands\fR, \fIrc\fR, \fIrifle\fR, \fIscope\fR. .IP "\fB\-\-choosefile\fR=\fItargetfile\fR" 14 .IX Item "--choosefile=targetfile" Allows you to pick a file with ranger. This changes the behavior so that when you open a file, ranger will exit and write the absolute path of that file into \&\fItargetfile\fR. .IP "\fB\-\-choosefiles\fR=\fItargetfile\fR" 14 .IX Item "--choosefiles=targetfile" Allows you to pick multiple files with ranger. This changes the behavior so that when you open a file, ranger will exit and write the absolute paths of all selected files into \fItargetfile\fR, adding one newline after each filename. .IP "\fB\-\-choosedir\fR=\fItargetfile\fR" 14 .IX Item "--choosedir=targetfile" Allows you to pick a directory with ranger. When you exit ranger, it will write the last visited directory into \fItargetfile\fR. .IP "\fB\-\-selectfile\fR=\fItargetfile\fR" 14 .IX Item "--selectfile=targetfile" Open ranger with \fItargetfile\fR selected. .IP "\fB\-\-list\-unused\-keys\fR" 14 .IX Item "--list-unused-keys" List common keys which are not bound to any action in the \*(L"browser\*(R" context. This list is not complete, you can bind any key that is supported by curses: use the key code returned by \f(CW\*(C`getch()\*(C'\fR. .IP "\fB\-\-list\-tagged\-files\fR=\fItag\fR" 14 .IX Item "--list-tagged-f
if __name__ == '__main__': from __init__ import init; init()
import unittest
import curses
from random import randint
from ranger.gui.displayable import Displayable, DisplayableContainer
from test import Fake, OK, raise_ok
class TestWithFakeCurses(unittest.TestCase):
def setUp(self):
self.win = Fake()
self.fm = Fake()
self.env = Fake()
self.settings = Fake()
self.initdict = {'win': self.win, 'settings': self.settings,
'fm': self.fm, 'env': self.env}
self.disp = Displayable(**self.initdict)
self.disc = DisplayableContainer(**self.initdict)
self.disc.add_child(self.disp)
hei, wid = 100, 100
self.env.termsize = (hei, wid)
def tearDown(self):
self.disp.destroy()
self.disc.destroy()
def test_colorscheme(self):
# Using a color method implies change of window attributes
disp = self.disp
disp.win.chgat = raise_ok
disp.win.attrset = raise_ok
self.assertRaises(OK, disp.color, 'a', 'b')
self.assertRaises(OK, disp.color_at, 0, 0, 0, 'a', 'b')
self.assertRaises(OK, disp.color_reset)
def test_focused_object(self):
d1 = Displayable(**self.initdict)
d2 = DisplayableContainer(**self.initdict)
for obj in (Displayable(**self.initdict) for x in range(5)):
d2.add_child(obj)
d3 = DisplayableContainer(**self.initdict)
for obj in (Displayable(**self.initdict) for x in range(5)):
d3.add_child(obj)
for obj in (d1, d2, d3):
self.disc.add_child(obj)
d3.container[3].focused = True
self.assertEqual(self.disc._get_focused_obj(), d3.container[3])
d3.container[3].focused = False
d2.container[0].focused = True
self.assertEqual(self.disc._get_focused_obj(), d2.container[0])
gWin = None
class TestDisplayableWithCurses(unittest.TestCase):
def setUp(self):
global gWin
if not gWin:
gWin = curses.initscr()
self.win = gWin
curses.cbreak()
curses.noecho()
curses.start_color()
curses.use_default_colors()
self.fm = Fake()
self.env = Fake()
self.settings = Fake()
self.initdict = {'win': self.win, 'settings': self.settings,
'fm': self.fm, 'env': self.env}
self.disp = Displayable(**self.initdict)
self.disc = DisplayableContainer(**self.initdict)
self.disc.add_child(self.disp)
self.env.termsize = self.win.getmaxyx()
def tearDown(self):
self.disp.destroy()
curses.nocbreak()
curses.echo()
curses.endwin()
def test_boundaries(self):
disp = self.disp
hei, wid = self.env.termsize
self.assertRaises(ValueError, disp.resize, 0, 0, hei + 1, wid)
self.assertRaises(ValueError, disp.resize, 0, 0, hei, wid + 1)
self.assertRaises(ValueError, disp.resize, -1, 0, hei, wid)
self.assertRaises(ValueError, disp.resize, 0, -1, hei, wid)
box = [int(randint(0, hei) * 0.2), 0,
int(randint(0, wid) * 0.2), 0]
box[1] = randint(box[0], hei)
box[1] = randint(box[0], hei)
def in_box(y, x):
return (x >= box[1] and x < box[1] + box[3]) and \
(y >= box[0] and y < box[0] + box[2])
disp.resize(*box)
for y, x in zip(range(10), range(10)):
is_in_box = in_box(y, x)
point1 = (y, x)
self.assertEqual(is_in_box, point1 in disp)
point2 = Fake()
point2.x = x
point2.y = y
self.assertEqual(is_in_box, point2 in disp)
def test_click(self):
self.disp.click = raise_ok
hei, wid = self.env.termsize
for i in range(50):
winwid = randint(2, wid-1)
winhei = randint(2, hei-1)
self.disc.resize(0, 0, hei, wid)
self.disp.resize(0, 0, winhei, winwid)
fakepos = Fake()
fakepos.x = winwid - 2
fakepos.y = winhei - 2
self.assertRaises(OK, self.disc.click, fakepos)
fakepos.x = winwid
fakepos.y = winhei
self.disc.click(fakepos)
if __name__ == '__main__':
unittest.main()