Skip to content

Commit

Permalink
Allow any number of breakpoint arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
thaliaarchi committed Feb 6, 2024
1 parent d802021 commit 269ff15
Showing 1 changed file with 3 additions and 5 deletions.
8 changes: 3 additions & 5 deletions ws.jq
Original file line number Diff line number Diff line change
Expand Up @@ -531,10 +531,8 @@ def debug:
else error end;

def breakpoint($args):
if $args|length > 1 then ("too many arguments\n"|prefix_error), .
elif $args|length == 1 then
def toggle: if . == null then true else not end;
$args[0] as $v |
def toggle: if . == null then true else not end;
reduce $args[] as $v (.;
if .labels|has($v) then
.breaks[.labels[$v]|tostring] |= toggle
else
Expand All @@ -543,7 +541,7 @@ def debug:
.breaks[$v] |= toggle
else ("undefined label or out-of-range pc: \($v)\n"|prefix_error), . end
end
else . end |
) |
if type == "object" then
.breaks as $breaks |
(.breaks | keys | map(tonumber) | sort[]) as $b |
Expand Down

0 comments on commit 269ff15

Please sign in to comment.