Skip to content

Commit

Permalink
nx-fzf script
Browse files Browse the repository at this point in the history
  • Loading branch information
andys8 committed Sep 5, 2024
1 parent 6989c5f commit 7e5833d
Showing 1 changed file with 25 additions and 0 deletions.
25 changes: 25 additions & 0 deletions bin/nx-fzf
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/bin/bash
# nx-fzf script to run nx commands with fzf

PROJECTS=$(nx show projects)
EXIT_CODE=$?

if [ "$EXIT_CODE" -ne 0 ]; then
echo "No nx projects found."
exit 1
fi

PROJECT=$(echo "$PROJECTS" | fzf)

if [ -z "$PROJECT" ]; then
exit 1
fi

TARGET=$(nx show project "$PROJECT" --json | jq -r '.targets | keys | .[]' | fzf)

if [ -z "$TARGET" ]; then
exit 1
fi

nx run "$PROJECT":"$TARGET"

0 comments on commit 7e5833d

Please sign in to comment.