summaryrefslogtreecommitdiffstats
path: root/parse.c
diff options
context:
space:
mode:
authorTavian Barnes <tavianator@tavianator.com>2020-11-03 13:29:57 -0500
committerTavian Barnes <tavianator@tavianator.com>2020-11-03 13:45:11 -0500
commit77e594145c6c3da49f5e65a793d7cba90091f6bd (patch)
tree00cbbcac53500d5980ef8c481d5ba40bc6b23d0e /parse.c
parente7a87862e6553873a53e90d982be6f3ef08a5ed2 (diff)
downloadbfs-77e594145c6c3da49f5e65a793d7cba90091f6bd.tar.xz
New -status option to display a status bar
Diffstat (limited to 'parse.c')
-rw-r--r--parse.c19
1 files changed, 16 insertions, 3 deletions
diff --git a/parse.c b/parse.c
index 7113a1f..458d736 100644
--- a/parse.c
+++ b/parse.c
@@ -2306,6 +2306,14 @@ static struct expr *parse_sparse(struct parser_state *state, int arg1, int arg2)
}
/**
+ * Parse -status.
+ */
+static struct expr *parse_status(struct parser_state *state, int arg1, int arg2) {
+ state->ctx->status = true;
+ return parse_nullary_option(state);
+}
+
+/**
* Parse -x?type [bcdpflsD].
*/
static struct expr *parse_type(struct parser_state *state, int x, int arg2) {
@@ -2658,8 +2666,9 @@ static struct expr *parse_help(struct parser_state *state, int arg1, int arg2) {
cfprintf(cout, " ${blu}-noleaf${rs}\n");
cfprintf(cout, " Ignored; for compatibility with GNU find\n");
cfprintf(cout, " ${blu}-regextype${rs} ${bld}TYPE${rs}\n");
- cfprintf(cout, " Use ${bld}TYPE${rs}-flavored regexes (default: ${bld}posix-basic${rs}; see ${blu}-regextype${rs}"
- " ${bld}help${rs})\n");
+ cfprintf(cout, " Use ${bld}TYPE${rs}-flavored regexes (default: ${bld}posix-basic${rs}; see ${blu}-regextype${rs} ${bld}help${rs})\n");
+ cfprintf(cout, " ${blu}-status${rs}\n");
+ cfprintf(cout, " Display a status bar while searching\n");
cfprintf(cout, " ${blu}-unique${rs}\n");
cfprintf(cout, " Skip any files that have already been seen\n");
cfprintf(cout, " ${blu}-warn${rs}\n");
@@ -2951,10 +2960,11 @@ static const struct table_entry parse_table[] = {
{"-since", T_TEST, parse_since, BFS_STAT_MTIME},
{"-size", T_TEST, parse_size},
{"-sparse", T_TEST, parse_sparse},
+ {"-status", T_OPTION, parse_status},
{"-true", T_TEST, parse_const, true},
{"-type", T_TEST, parse_type, false},
{"-uid", T_TEST, parse_user},
- {"-unique", T_ACTION, parse_unique},
+ {"-unique", T_OPTION, parse_unique},
{"-used", T_TEST, parse_used},
{"-user", T_TEST, parse_user},
{"-version", T_ACTION, parse_version},
@@ -3410,6 +3420,9 @@ void bfs_ctx_dump(const struct bfs_ctx *ctx, enum debug_flags flag) {
if (ctx->flags & BFTW_SKIP_MOUNTS) {
cfprintf(cerr, "${blu}-mount${rs} ");
}
+ if (ctx->status) {
+ cfprintf(cerr, "${blu}-status${rs} ");
+ }
if (ctx->unique) {
cfprintf(cerr, "${blu}-unique${rs} ");
}