aboutsummaryrefslogtreecommitdiff
path: root/doc/remembering.en.1.in
blob: c21b6534a579fd93c765391c3019e05752f49b6b (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
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
.TH REMEMBERING 1 @DATE@ "remembering @VERSION@"


.SH NAME

remembering - sort list from \fISTDIN\fR using past choices as weight.


.SH SYNOPSYS

\fBremembering\fR \fB-p\fR \fIPROFILE\fR \fB-c\fR \fICOMMAND\fR


.SH DESCRIPTION

\fBremembering\fR takes a command that chooses an option as its behaviour, such as \fBfzf\fR(1) or \fBdmenu\fR(1), and \fIremembers\fR what option is chosen, and as it is used, will put the most used choices at the beginning of the list.

\fBremembering\fR reads from STDIN and writes to STDOUT.
It expects STDIN to be sorted.


.SH OPTIONS

.TP
\fB-c\fR \fICOMMAND\fR
The \fICOMMAND\fR to be executed, reading from standard input (STDIN).

.TP
\fB-p\fR \fIPROFILE\fR
The name of the \fIPROFILE\fR where to look up and store raking data.

.TP
\fB-h\fR, \fB--help\fR
Show short help text.

.TP
\fB-V\fR, \fB--version\fR
Show version number.


.SH EXAMPLES

List current directory and feed it to \fBfzf\fR(1) via \fBremembering\fR:

.RS
.nf
$ ls | remembering -p fzf-ls -c fzf
.fi
.RE


Lists all executables available in \fI$PATH\fR, and feed those to \fBdmenu\fR(1) via \fBremembering\fR, and execute with \fBsh\fR(1) the choice picked:

.RS
.nf
$ dmenu_path | remembering -p dmenu-exe -c 'dmenu' | sh
.fi
.RE

.P
Successive invocations will put the frequent choices at the beginning.

.SS Simulation of an interactive session

Below is a simulation of an interactive session, comparing the usage of plain \fBfzf\fR(1) against composing it with \fBremembering\fR:

.RS
.nf
$ mkdir -p example/
$ cd example/
$ touch a b c d e
$ ls
a  b  c  d  e
$ ls | fzf
.fi
.RE

We begin creating a sample directory called "\f(CRexample/\fR", we cd into it and create 5 empty files: a, b, c, d and e.

\f(CRls\fR can list the directory for us, in this case in alphabetical order.

When we pipe the output of \f(CRls\fR into \fBfzf\fR(1), we are give given its prompt to pick one option:

.RS
.nf
  e
  d
  c
  b
> a
  5/5
>
.fi
.RE

Here \fBfzf\fR(1) lists the items it gets from \fISTDIN\fR in the order that it was given, and starts at the first one, "a".

Once we type "d" and press return, the output of \fBfzf\fR(1) is the choice:

.RS
.nf
$ ls | fzf
d
.fi
.RE

Now if we run the same command again, we'll be given the same options, in the same order:

.RS
.nf
$ ls | fzf

  e
  d
  c
  b
> a
  5/5
>

$ ls | fzf
d
.fi
.RE

\fBfzf\fR(1) is doing what it is told to: making a prompt with the options given to it from \fISTDIN\fR, in the order it was given.

In order to have our past choices show up in the beginning of the list, we can compose \fBfzf\fR(1) with \fBremembering\fR:

.RS
.nf
$ ls | remembering -p tutorial-example -c 'fzf'

  e
  d
  c
  b
> a
  5/5
>

$ ls | remembering -p tutorial-example -c 'fzf'
d
.fi
.RE

So far we get the exact same behaviour, but saying extra things.
We tell \fBremembering\fR that we want this specific \fIPROFILE\fR to be called "\f(CRtutorial-example\fR", and we give \fBremembering\fR the \f(CR'fzf'\fR command to be ran.

From now on if we run the exact same command again, \fBremembering\fR will \fIremember\fR that the last choice was "d", and put it in the beginning of the list, which \fBfzf\fR(1) happily displays in the order it was given:

.RS
.nf
$ ls | remembering -p tutorial-example -c 'fzf'

  e
  c
  b
  a
> d
  5/5
>

$ ls | remembering -p tutorial-example -c 'fzf'
d
.fi
.RE

This time the "d" option was already the first one, and we can just press return to get it as the output value from the command.

This example used \fBfzf\fR(1) as the \fICOMMAND\fR given to \fBremembering\fR, but you can give to the \fB-c\fR option anything that reads from \fISTDIN\fR, picks a line and writes to \fBSTDOUT\fR.


.SH SEE ALSO

\fBremembering\fR(5)


.SH AUTHORS

.MT eu@euandre.org
EuAndreh
.ME
and contributors.


.SH BUGS

.IP \(bu
Report bugs to the
.MT ~euandreh/public\-inbox@lists.sr.ht
mailing list
.ME .
Use the subject "\f(CR[remembering] BUG or TASK:
<description>\fR".
.IP \(bu
Browse bugs
.UR https://euandreh.xyz/remembering/TODOs.html
online
.UE .
.IP \(bu
.UR https://euandreh.xyz/remembering/en/
Homepage
.UE .
.IP \(bu
.UR https://lists.sr.ht/~euandreh/public\-inbox?search=%5Bremembering%5D
Comments and discussions
.UE .