diff options
author | 2021-11-07 02:38:38 -0800 | |
---|---|---|
committer | 2021-11-07 02:38:38 -0800 | |
commit | 68e2869d645b2588b1c5ce2045bb7663bdd3fa5d (patch) | |
tree | 50bc6e9d94e34517481f8c034c009eb213081131 /src | |
parent | c6818cc55c386264aef7317268921f149eabcb3e (diff) | |
download | bun-68e2869d645b2588b1c5ce2045bb7663bdd3fa5d.tar.gz bun-68e2869d645b2588b1c5ce2045bb7663bdd3fa5d.tar.zst bun-68e2869d645b2588b1c5ce2045bb7663bdd3fa5d.zip |
[bun run] Filter out `post*` and `pre*` from the completions
Diffstat (limited to 'src')
-rw-r--r-- | src/cli/run_command.zig | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/src/cli/run_command.zig b/src/cli/run_command.zig index af8fae0c8..952209a6b 100644 --- a/src/cli/run_command.zig +++ b/src/cli/run_command.zig @@ -433,7 +433,23 @@ pub const RunCommand = struct { } } - for (scripts.keys()) |key| { + const keys = scripts.keys(); + var key_i: usize = 0; + loop: while (key_i < keys.len) : (key_i += 1) { + const key = keys[key_i]; + + if (filter == Filter.script_exclude) { + for (reject_list) |default| { + if (std.mem.eql(u8, default, key)) { + continue :loop; + } + } + } + + if (strings.startsWith(key, "post") or strings.startsWith(key, "pre")) { + continue :loop; + } + var entry_item = results.getOrPutAssumeCapacity(key); if (filter == Filter.script_and_descriptions and max_description_len > 0) { |