fzy
terminal fuzzy finder picker
git clone https://9o.is/git/fzy.git
commit 27109d62f7ef890aaaef4fa8336b7116f6b9f73a parent 6fafca4c225b525c638559c9993ed60c7e417b27 Author: John Hawthorn <john.hawthorn@gmail.com> Date: Mon, 7 Dec 2015 17:11:42 -0800 Allow specifying count for benchmark This is helpful because some searches are an order of magnitude easier than others. Diffstat:
| M | fzy.c | | | 13 | ++++++++++--- |
1 file changed, 10 insertions(+), 3 deletions(-)
diff --git a/fzy.c b/fzy.c @@ -199,7 +199,7 @@ static struct option longopts[] = {{"show-matches", required_argument, NULL, 'e' {"prompt", required_argument, NULL, 'p'}, {"show-scores", no_argument, NULL, 's'}, {"version", no_argument, NULL, 'v'}, - {"benchmark", no_argument, NULL, 'b'}, + {"benchmark", optional_argument, NULL, 'b'}, {"help", no_argument, NULL, 'h'}, {NULL, 0, NULL, 0}}; @@ -220,7 +220,14 @@ int main(int argc, char *argv[]) { initial_query = optarg; break; case 'b': - benchmark = 1; + if (optarg) { + if (sscanf(optarg, "%d", &benchmark) != 1) { + usage(argv[0]); + exit(EXIT_FAILURE); + } + } else { + benchmark = 100; + } break; case 't': tty_filename = optarg; @@ -263,7 +270,7 @@ int main(int argc, char *argv[]) { fprintf(stderr, "Must specify -e/--show-matches with --benchmark\n"); exit(EXIT_FAILURE); } - for (int i = 0; i < 100; i++) + for (int i = 0; i < benchmark; i++) choices_search(&choices, initial_query); } else if (initial_query) { choices_search(&choices, initial_query);