From 544a42dd156d846b69312817690427d2f868a60f Mon Sep 17 00:00:00 2001 From: Johannes Obermair <48853629+johnnyomair@users.noreply.github.com> Date: Thu, 4 Jan 2024 08:05:38 +0100 Subject: [PATCH] Fix script matching via groups (#82) The change in #79 introduced a bug where matching via groups wouldn't work anymore. The group name was incorrectly checked for the first character of the name, which is always "@". To fix this, we correctly extract the group name from the pattern. --- .changeset/rude-kiwis-flash.md | 5 +++++ src/daemon-command/scripts-matching-pattern.ts | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) create mode 100644 .changeset/rude-kiwis-flash.md diff --git a/.changeset/rude-kiwis-flash.md b/.changeset/rude-kiwis-flash.md new file mode 100644 index 0000000..fd1e81d --- /dev/null +++ b/.changeset/rude-kiwis-flash.md @@ -0,0 +1,5 @@ +--- +"@comet/dev-process-manager": patch +--- + +Fix script matching via groups, for example, `npx dev-pm logs @api` diff --git a/src/daemon-command/scripts-matching-pattern.ts b/src/daemon-command/scripts-matching-pattern.ts index 3515942..a18a937 100644 --- a/src/daemon-command/scripts-matching-pattern.ts +++ b/src/daemon-command/scripts-matching-pattern.ts @@ -16,7 +16,7 @@ export function scriptsMatchingPattern(daemon: Daemon, { patterns }: ScriptsMatc const idExists = ids.some((id) => script.id === id); const nameExists = names.some((name) => { if (name === "all") return true; - if (name[0] === "@" && script.groups.includes(name[0])) return true; + if (name[0] === "@" && script.groups.includes(name.substring(1))) return true; return script.name === name; });