Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions commands/web/xb-cspell
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,27 @@

## #ddev-generated
## Description: Check for spelling errors with cspell.
## Usage: xb-cspell
## Example: ddev xb-cspell # Check for spelling errors.\nddev cspell # Same, via alias.
## Usage: xb-cspell [staged]
## Example: ddev xb-cspell # Check for spelling errors across the module.\nddev xb-cspell staged # Check only files staged for commit.
## Aliases: cspell,spell
## ExecRaw: false
## Flags: []
## AutocompleteTerms: ["staged"]

cd "$DDEV_COMPOSER_ROOT/$DDEV_DOCROOT/modules/contrib/canvas" || exit 1

npm run lint:cspell
case "$1" in
"staged")
staged_files=$(git diff --cached --name-only --diff-filter=ACMR)
if [ -z "$staged_files" ]; then
echo "Nothing staged; skipping cspell."
exit 0
fi
npx cspell --no-progress --no-must-find-files $staged_files
;;
"") npm run lint:cspell ;;
*)
echo "Invalid argument: $1"
exit 1
;;
esac