edit.indent.rc 761 B

123456789101112131415161718192021222324252627
  1. #! /bin/sh
  2. # *** External Formatter (Indenter) for GNU Midnight Commander.
  3. # arguments:
  4. # $1 - Name of the file being edited
  5. # $2 - Name of the file to be processed
  6. exec >/dev/null
  7. case `echo $1 |sed 's/^.*\.//'` in
  8. c|C|cc|CC|cxx|CXX|cpp|CPP|c++|C++|h|H|hh|hxx|hpp)
  9. # https://clang.llvm.org/docs/ClangFormat.html
  10. # Please add options to your .clang-format, not here.
  11. clang-format -i "$2"
  12. ;;
  13. java|JAVA)
  14. # https://astyle.sourceforge.net
  15. astyle --style=java --mode=java "$2"
  16. ;;
  17. htm|html|HTM|HTML)
  18. # https://tidy.sourceforge.net
  19. tidy -q -m -ascii -wrap 80 "$2"
  20. ;;
  21. *)
  22. # https://www.gnu.org/software/coreutils/
  23. fmt "$2" >"$2.tmp" && rm -f "$2" && mv -f "$2.tmp" "$2"
  24. ;;
  25. esac