code / bb

Lines2.7K C1.8K Shell331 YAML273 Markdown197 make44
(238 lines)
1 .\" Manpage for bbcmd.
2 .\" Contact bruce@bruce-hill.com to correct errors or typos.
3 .TH man 1 "23 Feb 2020" "0.26" "bbcmd manual page"
5 .de TPx
6 . TP 4n
7 ..
9 .SH NAME
10 \fBbbcmd\fR \- Run commands in \fBbb\fR, the command line file browser
11 .SH SYNOPSIS
12 .B bbcmd
13 (\fIcmd\fR[\fI:value\fR])* [\fIcmd\fR: \fIvalue\fR*]
15 .SH DESCRIPTION
16 \fBbbcmd\fR is a script that can be run from within \fBbb\fR (the command line
17 file browser). \fBbbcmd\fR is used to manipulate \fBbb\fR's behavior and state.
18 Typically, this is done through scripts that are bound to keypresses, or during
19 \fBbb\fR's startup scripts.
21 .SH TRAILING ARGUMENTS
22 If a command ends with a colon and there are more arguments after it, the
23 additional arguments are treated as repeated invocations of that command.
24 Example: `\fBbbcmd select: one two\fR` is equivalent to `\fBbbcmd
25 select:one select:two\fR`
27 .SH PIPED VALUES
28 If no arguments are given, commands are read from \fBstdin\fR, separated by
29 \fBNULL\fR bytes (\fB\\0\fR). Example: `\fBprintf 'select:%s\\0' one two | bbcmd\fR`
30 is equivalent to `\fBbbcmd select:one select:two\fR`.
32 If the last argument given is a command with a trailing colon, arguments for
33 that command are read from \fBstdin\fR, separated by \fBNULL\fR bytes
34 (\fB\\0\fR). Example: `\fBprintf '%s\\0' one two | bbcmd select:\fR` is equivalent
35 to `\fBbbcmd select:one select:two\fR`
37 .SH COMMANDS
38 Each of the following are commands that can be run with \fBbbcmd\fR from within
39 \fBbb\fR, typically through keyboard-bound scripts:
41 .RS
42 .IP \fBbind\fR:\fIkeys\fR:\fIscript\fR
43 Bind the given key presses to run the given script.
45 .IP \fBcd\fR:\fIpath\fR
46 Navigate \fBbb\fR to \fIpath\fR.
48 .IP \fBcolumns\fR:\fIcolumns\fR
49 Change which columns are visible, and in what order. The default setting is
50 \fB*smpn\fR. The available columns are:
53 .P
54 .PD 0
55 .RS
57 .TPx
58 .B *
59 Whether or not the file is selected.
61 .TPx
62 .B n
63 The name of the file
65 .TPx
66 .B s
67 The size of the file
69 .TPx
70 .B p
71 The permissions of the file
73 .TPx
74 .B m
75 The modification time of the file (relative)
77 .TPx
78 .B M
79 The modification time of the file (absolute)
81 .TPx
82 .B c
83 The creation time of the file (relative)
85 .TPx
86 .B C
87 The creation time of the file (absolute)
89 .TPx
90 .B a
91 The access time of the file (relative)
93 .TPx
94 .B A
95 The access time of the file (absolute)
97 .TPx
98 .B r
99 The random index of the file
101 .RE
102 .PD
104 .IP \fBdeselect\fR[:\fIfilename\fR]
105 Deselect \fIfilename\fR (default: all selected files).
107 .IP \fBfg\fR[:\fInum\fR]
108 Send background process \fInum\fR to the foreground (default: the most recent
109 process).
111 .IP \fBglob\fR:\fIpattern\fR
112 The glob pattern for which files to show (default: `*`). See: \fBglob\fR(7) for
113 more details on globbing.
115 .IP \fBgoto\fR:\fIfilename\fR
116 Move the cursor to filename (changing directory if needed).
118 .IP \fBhelp\fR
119 Show the help menu.
121 .IP \fBinterleave\fR[:\fI0\fR|\fI1\fR]
122 Whether or not directories should be interleaved with files in the display
123 (default: toggle)
125 .IP \fBmove\fR:\fInum\fR
126 Move the cursor a numeric amount. See the \fBNUMBERS\fR section below.
128 .IP \fBquit\fR
129 Quit \fBbb\fR.
131 .IP \fBrefresh\fR
132 Refresh the file listing.
134 .IP \fBscroll\fR:\fInum\fR
135 Scroll the view a numeric amount. See the \fBNUMBERS\fR section below.
137 .IP \fBselect\fR[:\fIfilename\fR]
138 Select \fIfilename\fR (default: all visible files).
140 .IP \fBsort\fR:([\fI+\fR|\fI-\fR]\fImethod\fR)+
141 Sort files according to \fImethod\fR (\fI+\fR: normal, \fI-\fR: reverse,
142 default: toggle the current direction). Additional methods (if any) act as
143 tiebreaker. The default setting is \fB+n\fR. The values for \fImethod\fR must
144 be one or more of the following single-letter characters:
146 .PD 0
147 .RS
148 .TPx
149 .B n
150 name
151 .TPx
152 .B s
153 size
154 .TPx
155 .B m
156 modification time
157 .TPx
158 .B c
159 creation time
160 .TPx
161 .B a
162 access time
163 .TPx
164 .B r
165 random
166 .TPx
167 .B p
168 permissions
169 .RE
170 .PD
172 .IP \fBspread\fR:\fInum\fR
173 Spread the selection state at the cursor. See the \fBNUMBERS\fR
174 section below.
176 .IP \fBtoggle\fR[:\fIfilename\fR]
177 Toggle the selection status of \fIfilename\fR (default: all visible files).
179 .RE
181 .SH NUMBERS
182 In commands which take a number (\fBscroll\fR, \fBmove\fR, and \fBspread\fR),
183 the number can be one of the following:
185 .PD 0
186 .RS
187 .TP 8
188 .B N
189 An absolute number (e.g. \fB5\fR), meaning the \fBN\fRth visible file.
190 .TP 8
191 .B N%
192 A percentage of screen height (e.g. \fB50%\fR), meaning the visible file
193 \fBN%\fR of the way down the screen.
194 .TP 8
195 .B N%n
196 A percentage of the files (e.g. \fB50%n\fR), meaning the visible file \fBN%\fR
197 of the way down the list.
198 .TP 8
199 .B +/-num
200 An offset (e.g. \fB+1\fR, \fB-1\fR, \fB+25%\fR, \fB-10%n\fR), which interprets
201 the following number as relative to the current cursor position.
202 .RE
203 .PD
205 .SH EXAMPLES
206 .TP
208 bbcmd cd:/usr/local/
209 Navigate to /usr/local/
211 .TP
213 bbcmd select:"$BB" move:+1
214 Select the file under the cursor, then move the cursor down one file.
216 .TP
218 bbcmd select: *.jpg
219 Select all \fB.jpg\fR files in the current directory.
221 .TP
223 for f in *.jpg; do printf 'select:%s\\0'; done | bbcmd
224 Select all \fB.jpg\fR files in the current directory, using the "pipe commands
225 to bbcmd" functionality.
227 .TP
229 find . -name '*.jpg' -print0 | bbcmd select:
230 Select all \fB.jpg\fR files in the current directory or its subdirectories,
231 using the "pipe arguments to a command" functionality.
233 .SH "SEE ALSO"
234 .sp
235 \fBbb\fR(1)
237 .SH AUTHOR
238 Bruce Hill (bruce@bruce-hill.com)