Files
rdb/man/pick.man
T

84 lines
2.3 KiB
Groff

.TH pick "" "" "/rdb Command"
.PC "Scroll through a table and choose one or more rows"
\fBpick \fB[ -m ] [ -k \fIkeys\fB ] < \fItable \fB> \fIchosenrows\fR
.PP
.II "pick^choose rows"
.II "table^scroll"
.I "(Ruby re-creation only; the original /rdb has no such command.)"
.PP
The command
.B pick
shows
.I table
on the terminal, lets the user scroll through it, and writes the rows
that were chosen as a table on the standard output.
It therefore fits into the middle of a pipe:
.DM
column Item Description < inventory | pick -m | jointable - owners
pick -m < inventory | total Amount Value
.DE
.PP
The table is read from the standard input;
the keys are read from the terminal (\fB/dev/tty\fR).
A list is read like a table, and the output is always a table.
The head and the dash line stay at the top while the rows scroll.
.SH Keys
.nf
Up, Down move the cursor one row
PgUp, PgDn move a page
Home, End first or last row
Enter choose and finish
Space mark the row, move down (with -m)
a mark all shown rows; again, unmark them (with -m)
/ filter: type text, shown rows must contain it
(Enter keeps the filter, Esc clears it)
Esc, q, Ctrl-C cancel
.fi
.PP
.B pick
writes the marked rows in table order.
If no row is marked, it writes the row under the cursor.
Marks stay when a filter hides the row.
If the user cancels, or the filter leaves no row to choose,
.B pick
writes nothing and exits with status 1.
.SH Options
.IP \fB-m\fR 0.5i
Allow several rows: Space marks, \fBa\fR marks all.
Without it, Enter chooses the row under the cursor.
.IP "\fB-k\fR \fIkeys\fR"
Take the keys from this string instead of the terminal.
Words are key names:
.BR up ,
.BR down ,
.BR pgup ,
.BR pgdn ,
.BR home ,
.BR end ,
.BR enter ,
.BR space ,
.BR esc ,
.BR backspace ;
any other word is typed character by character.
This is for scripts, demonstrations and tests.
.SH Example
.DM
pick -m -k 'down space down down space enter' < inventory
.DE
.PP
marks the second and the fifth row and prints:
.DM
Item Amount Cost Value Description
---- ------ ---- ------ --------------
2 100 0.50 50.00 test tubes
5 99 2.45 242.55 cleaning cloth
.DE
.SH "See Also"
.B
display,
mask,
row,
search
.R
.SO rdb