(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 TPx6 . TP 4n7 ..9 .SH NAME10 \fBbbcmd\fR \- Run commands in \fBbb\fR, the command line file browser11 .SH SYNOPSIS12 .B bbcmd13 (\fIcmd\fR[\fI:value\fR])* [\fIcmd\fR: \fIvalue\fR*]15 .SH DESCRIPTION16 \fBbbcmd\fR is a script that can be run from within \fBbb\fR (the command line17 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 during19 \fBbb\fR's startup scripts.21 .SH TRAILING ARGUMENTS22 If a command ends with a colon and there are more arguments after it, the23 additional arguments are treated as repeated invocations of that command.24 Example: `\fBbbcmd select: one two\fR` is equivalent to `\fBbbcmd25 select:one select:two\fR`27 .SH PIPED VALUES28 If no arguments are given, commands are read from \fBstdin\fR, separated by29 \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 for33 that command are read from \fBstdin\fR, separated by \fBNULL\fR bytes34 (\fB\\0\fR). Example: `\fBprintf '%s\\0' one two | bbcmd select:\fR` is equivalent35 to `\fBbbcmd select:one select:two\fR`37 .SH COMMANDS38 Each of the following are commands that can be run with \fBbbcmd\fR from within39 \fBbb\fR, typically through keyboard-bound scripts:41 .RS42 .IP \fBbind\fR:\fIkeys\fR:\fIscript\fR43 Bind the given key presses to run the given script.45 .IP \fBcd\fR:\fIpath\fR46 Navigate \fBbb\fR to \fIpath\fR.48 .IP \fBcolumns\fR:\fIcolumns\fR49 Change which columns are visible, and in what order. The default setting is50 \fB*smpn\fR. The available columns are:51 .52 .53 .P54 .PD 055 .RS56 .57 .TPx58 .B *59 Whether or not the file is selected.60 .61 .TPx62 .B n63 The name of the file64 .65 .TPx66 .B s67 The size of the file68 .69 .TPx70 .B p71 The permissions of the file72 .73 .TPx74 .B m75 The modification time of the file (relative)76 .77 .TPx78 .B M79 The modification time of the file (absolute)80 .81 .TPx82 .B c83 The creation time of the file (relative)84 .85 .TPx86 .B C87 The creation time of the file (absolute)88 .89 .TPx90 .B a91 The access time of the file (relative)92 .93 .TPx94 .B A95 The access time of the file (absolute)96 .97 .TPx98 .B r99 The random index of the file100 .101 .RE102 .PD104 .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 recent109 process).111 .IP \fBglob\fR:\fIpattern\fR112 The glob pattern for which files to show (default: `*`). See: \fBglob\fR(7) for113 more details on globbing.115 .IP \fBgoto\fR:\fIfilename\fR116 Move the cursor to filename (changing directory if needed).118 .IP \fBhelp\fR119 Show the help menu.121 .IP \fBinterleave\fR[:\fI0\fR|\fI1\fR]122 Whether or not directories should be interleaved with files in the display123 (default: toggle)125 .IP \fBmove\fR:\fInum\fR126 Move the cursor a numeric amount. See the \fBNUMBERS\fR section below.128 .IP \fBquit\fR129 Quit \fBbb\fR.131 .IP \fBrefresh\fR132 Refresh the file listing.134 .IP \fBscroll\fR:\fInum\fR135 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 as143 tiebreaker. The default setting is \fB+n\fR. The values for \fImethod\fR must144 be one or more of the following single-letter characters:145 .P146 .PD 0147 .RS148 .TPx149 .B n150 name151 .TPx152 .B s153 size154 .TPx155 .B m156 modification time157 .TPx158 .B c159 creation time160 .TPx161 .B a162 access time163 .TPx164 .B r165 random166 .TPx167 .B p168 permissions169 .RE170 .PD172 .IP \fBspread\fR:\fInum\fR173 Spread the selection state at the cursor. See the \fBNUMBERS\fR174 section below.176 .IP \fBtoggle\fR[:\fIfilename\fR]177 Toggle the selection status of \fIfilename\fR (default: all visible files).179 .RE181 .SH NUMBERS182 In commands which take a number (\fBscroll\fR, \fBmove\fR, and \fBspread\fR),183 the number can be one of the following:185 .PD 0186 .RS187 .TP 8188 .B N189 An absolute number (e.g. \fB5\fR), meaning the \fBN\fRth visible file.190 .TP 8191 .B N%192 A percentage of screen height (e.g. \fB50%\fR), meaning the visible file193 \fBN%\fR of the way down the screen.194 .TP 8195 .B N%n196 A percentage of the files (e.g. \fB50%n\fR), meaning the visible file \fBN%\fR197 of the way down the list.198 .TP 8199 .B +/-num200 An offset (e.g. \fB+1\fR, \fB-1\fR, \fB+25%\fR, \fB-10%n\fR), which interprets201 the following number as relative to the current cursor position.202 .RE203 .PD205 .SH EXAMPLES206 .TP207 .B208 bbcmd cd:/usr/local/209 Navigate to /usr/local/211 .TP212 .B213 bbcmd select:"$BB" move:+1214 Select the file under the cursor, then move the cursor down one file.216 .TP217 .B218 bbcmd select: *.jpg219 Select all \fB.jpg\fR files in the current directory.221 .TP222 .B223 for f in *.jpg; do printf 'select:%s\\0'; done | bbcmd224 Select all \fB.jpg\fR files in the current directory, using the "pipe commands225 to bbcmd" functionality.227 .TP228 .B229 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 .sp235 \fBbb\fR(1)237 .SH AUTHOR238 Bruce Hill (bruce@bruce-hill.com)