mconnect - KDE Connect protocol implementation in Vala/C
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

43 lines
1.3 KiB

  1. #!/bin/sh
  2. [ "$V" = "1" ] && set -x
  3. SELFDIR=$(readlink -f $(dirname $0))
  4. CFG=${SELFDIR}/uncrustify.cfg
  5. UNCRUSTIFY=${UNCRUSTIFY:-uncrustify}
  6. SRCDIR=${SRCDIR:-$(readlink -f ${SELFDIR}/../src ${SELFDIR}/../test | \
  7. tr '\n' ' ')}
  8. FILES=$(find $SRCDIR -name '*.vala')
  9. if [ "$FILES" = "" ]; then
  10. echo "no relevant source files found in $SRCDIR"
  11. exit 1
  12. fi
  13. cmd=$1
  14. case "$cmd" in
  15. check)
  16. echo "-- uncrustify version $(${UNCRUSTIFY} --version)"
  17. ${UNCRUSTIFY} -c ${CFG} --check -q $FILES
  18. ;;
  19. apply|fix)
  20. ${UNCRUSTIFY} -c ${CFG} --replace $FILES
  21. ;;
  22. help|-h|--help)
  23. echo "Usage:"
  24. echo " $(basename $0) <command>"
  25. echo
  26. echo "Commands:"
  27. echo " check - check if source code is properly formatted"
  28. echo " exit code will be non-0 if code is badly formatted"
  29. echo " fix - fix formatting"
  30. echo " help - show this message"
  31. echo
  32. echo "Environment variables:"
  33. echo " UNCRUSTIFY - override path to 'uncrustify' tool, default: $UNCRUSTIFY"
  34. echo " SRCDIR - override path to source directory, default: $SRCDIR"
  35. ;;
  36. *)
  37. echo "unsupported command $cmd, see --help"
  38. ;;
  39. esac