Skip to content

Commit

Permalink
Fix script matching via groups (#82)
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
johnnyomair authored Jan 4, 2024
1 parent 8427997 commit 544a42d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/rude-kiwis-flash.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@comet/dev-process-manager": patch
---

Fix script matching via groups, for example, `npx dev-pm logs @api`
2 changes: 1 addition & 1 deletion src/daemon-command/scripts-matching-pattern.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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;
});

Expand Down

0 comments on commit 544a42d

Please sign in to comment.