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.

42 lines
1.2 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. ${UNCRUSTIFY} -c ${CFG} --check -q $FILES
  17. ;;
  18. apply|fix)
  19. ${UNCRUSTIFY} -c ${CFG} --replace $FILES
  20. ;;
  21. help|-h|--help)
  22. echo "Usage:"
  23. echo " $(basename $0) <command>"
  24. echo
  25. echo "Commands:"
  26. echo " check - check if source code is properly formatted"
  27. echo " exit code will be non-0 if code is badly formatted"
  28. echo " fix - fix formatting"
  29. echo " help - show this message"
  30. echo
  31. echo "Environment variables:"
  32. echo " UNCRUSTIFY - override path to 'uncrustify' tool, default: $UNCRUSTIFY"
  33. echo " SRCDIR - override path to source directory, default: $SRCDIR"
  34. ;;
  35. *)
  36. echo "unsupported command $cmd, see --help"
  37. ;;
  38. esac