Skip to content

Commit

Permalink
any-forbidden
Browse files Browse the repository at this point in the history
  • Loading branch information
GitOnUp committed Mar 23, 2024
1 parent 8851fef commit 8b66cd7
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
2 changes: 2 additions & 0 deletions docs/plugins/autodump.rst
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ Options
Only process hidden items.
``forbidden``
Only process forbidden items (default: only unforbidden).
``any-forbidden``
Process items regardless of forbidden-ness.

Examples
--------
Expand Down
12 changes: 6 additions & 6 deletions plugins/autodump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame
bool need_visible = false;
bool need_hidden = false;
bool need_forbidden = false;
bool need_unforbidden = false;
bool any_forbidden = false;
for (size_t i = 0; i < parameters.size(); i++)
{
string & p = parameters[i];
Expand All @@ -93,8 +93,8 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame
need_hidden = true;
else if (p == "forbidden")
need_forbidden = true;
else if (p == "unforbidden")
need_unforbidden = true;
else if (p == "any-forbidden")
any_forbidden = true;
else
return CR_WRONG_USAGE;
}
Expand All @@ -105,8 +105,8 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame
return CR_WRONG_USAGE;
}

if (need_forbidden && need_unforbidden) {
out.printerr("An item can't be both forbidden an unforbidden.\n");
if (need_forbidden && any_forbidden) {
out.printerr("Can't specify both forbidden and any-forbidden.\n");
return CR_WRONG_USAGE;
}

Expand Down Expand Up @@ -167,7 +167,7 @@ static command_result autodump_main(color_ostream &out, vector <string> & parame
continue;
if (need_forbidden && !itm->flags.bits.forbid)
continue;
if (need_unforbidden && itm->flags.bits.forbid)
if (!any_forbidden && !need_forbidden && itm->flags.bits.forbid)
continue;

if (!destroy) // move to cursor
Expand Down

0 comments on commit 8b66cd7

Please sign in to comment.