| ... | ... |
@@ -21,6 +21,10 @@ heuristics for the best match. |
| 21 | 21 |
How many lines of items to display. If unspecified, defaults to 10 lines. |
| 22 | 22 |
. |
| 23 | 23 |
.TP |
| 24 |
+.BR \-p ", " \-\-prompt =\fIPROMPT\fR |
|
| 25 |
+Input prompt (default: '> ') |
|
| 26 |
+. |
|
| 27 |
+.TP |
|
| 24 | 28 |
.BR \-s ", " \-\-show-scores |
| 25 | 29 |
Show the scores for each item. |
| 26 | 30 |
. |
| ... | ... |
@@ -16,6 +16,8 @@ int flag_show_scores = 0; |
| 16 | 16 |
size_t num_lines = 10; |
| 17 | 17 |
size_t scrolloff = 1; |
| 18 | 18 |
|
| 19 |
+const char *prompt = "> "; |
|
| 20 |
+ |
|
| 19 | 21 |
void read_choices(choices_t *c){
|
| 20 | 22 |
char *line = NULL; |
| 21 | 23 |
size_t len = 0; |
| ... | ... |
@@ -89,7 +91,6 @@ void draw(tty_t *tty, choices_t *choices){
|
| 89 | 91 |
start = choices_available(choices) - num_lines; |
| 90 | 92 |
} |
| 91 | 93 |
} |
| 92 |
- const char *prompt = "> "; |
|
| 93 | 94 |
tty_setcol(tty, 0); |
| 94 | 95 |
tty_printf(tty, "%s%s", prompt, search); |
| 95 | 96 |
tty_clearline(tty); |
| ... | ... |
@@ -177,11 +178,12 @@ void run(tty_t *tty, choices_t *choices){
|
| 177 | 178 |
static const char *usage_str = "" |
| 178 | 179 |
"Usage: fzy [OPTION]...\n" |
| 179 | 180 |
" -l, --lines=LINES Specify how many lines of results to show (default 10)\n" |
| 180 |
-" -e, --show-matches=QUERY output the sorted matches of QUERY\n" |
|
| 181 |
+" -p, --prompt=PROMPT Input prompt (default '> ')\n" |
|
| 182 |
+" -e, --show-matches=QUERY Output the sorted matches of QUERY\n" |
|
| 181 | 183 |
" -t, --tty=TTY Specify file to use as TTY device (default /dev/tty)\n" |
| 182 |
-" -s, --show-scores show the scores of each match\n" |
|
| 183 |
-" -h, --help display this help and exit\n" |
|
| 184 |
-" -v, --version output version information and exit\n"; |
|
| 184 |
+" -s, --show-scores Show the scores of each match\n" |
|
| 185 |
+" -h, --help Display this help and exit\n" |
|
| 186 |
+" -v, --version Output version information and exit\n"; |
|
| 185 | 187 |
|
| 186 | 188 |
void usage(const char *argv0){
|
| 187 | 189 |
fprintf(stderr, usage_str, argv0); |
| ... | ... |
@@ -191,6 +193,7 @@ static struct option longopts[] = {
|
| 191 | 193 |
{ "show-matches", required_argument, NULL, 'e' },
|
| 192 | 194 |
{ "lines", required_argument, NULL, 'l' },
|
| 193 | 195 |
{ "tty", required_argument, NULL, 't' },
|
| 196 |
+ { "prompt", required_argument, NULL, 'p' },
|
|
| 194 | 197 |
{ "show-scores", no_argument, NULL, 's' },
|
| 195 | 198 |
{ "version", no_argument, NULL, 'v' },
|
| 196 | 199 |
{ "benchmark", no_argument, NULL, 'b' },
|
| ... | ... |
@@ -203,7 +206,7 @@ int main(int argc, char *argv[]){
|
| 203 | 206 |
char *initial_query = NULL; |
| 204 | 207 |
char *tty_filename = "/dev/tty"; |
| 205 | 208 |
char c; |
| 206 |
- while((c = getopt_long(argc, argv, "vhse:l:t:", longopts, NULL)) != -1){
|
|
| 209 |
+ while((c = getopt_long(argc, argv, "vhse:l:t:p:", longopts, NULL)) != -1){
|
|
| 207 | 210 |
switch(c){
|
| 208 | 211 |
case 'v': |
| 209 | 212 |
printf("%s " VERSION " (c) 2014 John Hawthorn\n", argv[0]);
|
| ... | ... |
@@ -220,6 +223,9 @@ int main(int argc, char *argv[]){
|
| 220 | 223 |
case 't': |
| 221 | 224 |
tty_filename = optarg; |
| 222 | 225 |
break; |
| 226 |
+ case 'p': |
|
| 227 |
+ prompt = optarg; |
|
| 228 |
+ break; |
|
| 223 | 229 |
case 'l': |
| 224 | 230 |
{
|
| 225 | 231 |
int l; |