tmenu

Terminal menu for selecting items from stdin
git clone https://git.sinitax.com/sinitax/tmenu
Log | Files | Refs | README | LICENSE | sfeed.txt

commit 9f13ff2d7ab94a25764ec56d9807f39dfd3e854a
parent e3dd4812e3c7b5e8c2fc2ddffe7aab7de0c99a6c
Author: Louis Burda <quent.burda@gmail.com>
Date:   Wed, 11 Jan 2023 19:56:01 +0100

Add verbose flag

Diffstat:
Mtmenu.c | 10+++++++++-
1 file changed, 9 insertions(+), 1 deletion(-)

diff --git a/tmenu.c b/tmenu.c @@ -114,6 +114,8 @@ static const struct mode modes[] = { static FILE *infile; +static bool verbose; + static size_t *entries; static size_t entries_cap, entries_cnt; @@ -613,7 +615,9 @@ run(const char *filepath) load_entries(filepath); - eprintf("Loaded %lu entries\n", entries_cnt); + if (verbose) + eprintf("Loaded %lu entries\n", entries_cnt); + if (!entries_cnt) return; if (tcgetattr(fileno(stdin), &prevterm)) @@ -696,6 +700,9 @@ parseopt(const char *flag, const char **args) case 'm': multiout = true; return 0; + case 'v': + verbose = true; + return 0; case 'b': fwdctx = strtol(*args, &end, 10); if (end && *end) goto badint; @@ -728,6 +735,7 @@ main(int argc, const char **argv) entry = NULL; entries = NULL; + verbose = false; filepath = NULL; for (i = 1; i < argc; i++) { if (*argv[i] == '-') {