-
Notifications
You must be signed in to change notification settings - Fork 28
Open
Description
Hello!
I've been using rustywind to sort Tailwind classes in an Elm app. To get Intellisense working in VS Code, I'm using regexes from this article, which I've adapted to a rustywind.sh script:
#!/usr/bin/env bash
set -eu
# Default to write mode
MODE="--write"
# Check if --check-formatted flag is passed
if [ "$#" -gt 0 ] && [ "$1" = "--check-formatted" ]; then
MODE="--check-formatted"
fi
rustywind $MODE --custom-regex "\bclass[\s(<|]+\"([^\"]*)\"" .
rustywind $MODE --custom-regex "\bclass[\s(]+\"[^\"]*\"[\s+]+\"([^\"]*)\"" .
rustywind $MODE --custom-regex "\bclass[\s<|]+\"[^\"]*\"\s*\+{2}\s*\" ([^\"]*)\"" .
rustywind $MODE --custom-regex "\bclass[\s<|]+\"[^\"]*\"\s*\+{2}\s*\" [^\"]*\"\s*\+{2}\s*\" ([^\"]*)\"" .
rustywind $MODE --custom-regex "\bclass[\s<|]+\"[^\"]*\"\s*\+{2}\s*\" [^\"]*\"\s*\+{2}\s*\" [^\"]*\"\s*\+{2}\s*\" ([^\"]*)\"" .
rustywind $MODE --custom-regex "\bclassList[\s\[\(]+\"([^\"]*)\"" .
rustywind $MODE --custom-regex "\bclassList[\s\[\(]+\"[^\"]*\",\s[^\)]+\)[\s\[\(,]+\"([^\"]*)\"" .
rustywind $MODE --custom-regex "\bclassList[\s\[\(]+\"[^\"]*\",\s[^\)]+\)[\s\[\(,]+\"[^\"]*\",\s[^\)]+\)[\s\[\(,]+\"([^\"]*)\"" .Running ./shell-scripts/rustywind.sh --check-formatted for example outputs the following
only printing changed files
only printing changed files
only printing changed files
only printing changed files
only printing changed files
only printing changed files
only printing changed files
only printing changed files
It would be slightly nicer to avoid the duplicate output, if we had support for multiple --custom-regex flags, something like
rustywind --custom-regex "\bclass[\s(<|]+\"([^\"]*)\"" \
--custom-regex "\bclass[\s(]+\"[^\"]*\"[\s+]+\"([^\"]*)\"" \
--custom-regex "\bclass[\s<|]+\"[^\"]*\"\s*\+{2}\s*\" ([^\"]*)\"" \
--custom-regex "\bclass[\s<|]+\"[^\"]*\"\s*\+{2}\s*\" [^\"]*\"\s*\+{2}\s*\" ([^\"]*)\"" \
--custom-regex "\bclass[\s<|]+\"[^\"]*\"\s*\+{2}\s*\" [^\"]*\"\s*\+{2}\s*\" [^\"]*\"\s*\+{2}\s*\" ([^\"]*)\"" \
--custom-regex "\bclassList[\s\[\(]+\"([^\"]*)\"" \
--custom-regex "\bclassList[\s\[\(]+\"[^\"]*\",\s[^\)]+\)[\s\[\(,]+\"([^\"]*)\"" \
--custom-regex "\bclassList[\s\[\(]+\"[^\"]*\",\s[^\)]+\)[\s\[\(,]+\"[^\"]*\",\s[^\)]+\)[\s\[\(,]+\"([^\"]*)\"" .The issue of "multiple regexes" seems to have been raised before in #27, and that issue was closed as "completed". Is there a way of using multiple regexes? If not, would that be a welcomed change?
Metadata
Metadata
Assignees
Labels
No labels