Reviewed By: jvillard Differential Revision: D9333255 fbshipit-source-id: 7b5de2d61master
parent
e3e521afca
commit
ecde8a7660
@ -0,0 +1,27 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
# Copyright (c) 2017-present, Facebook, Inc.
|
||||||
|
#
|
||||||
|
# This source code is licensed under the MIT license found in the
|
||||||
|
# LICENSE file in the root directory of this source tree.
|
||||||
|
|
||||||
|
# Run ocamlformat, installing the required version via opam if necessary.
|
||||||
|
|
||||||
|
set -x
|
||||||
|
set -e
|
||||||
|
|
||||||
|
TARGET_VERSION=$(grep version .ocamlformat | cut -d ' ' -f 2)
|
||||||
|
|
||||||
|
if [ -z $TARGET_VERSION ]
|
||||||
|
then
|
||||||
|
echo "Could not find .ocamlformat file containing version"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -x "$(command -v ocamlformat)" ] ||
|
||||||
|
[ "$TARGET_VERSION" != "$(ocamlformat --version)" ]
|
||||||
|
then
|
||||||
|
opam install "ocamlformat.$TARGET_VERSION"
|
||||||
|
fi
|
||||||
|
|
||||||
|
ocamlformat "$@"
|
Loading…
Reference in new issue