From e6472cc500447aa6a82fa066f18ef9cf00af8d1c Mon Sep 17 00:00:00 2001
From: Andreas Traczyk <andreas.traczyk@savoirfairelinux.com>
Date: Tue, 18 Aug 2020 15:07:07 -0400
Subject: [PATCH] misc: remove format.sh

Formatting scripts will now be located in the 'ring-project' repo
and installed per cpp-submodule.

Change-Id: I8f7a376a541e0c9cc8e5fcb569184d231be8ed21
---
 format.sh | 91 -------------------------------------------------------
 1 file changed, 91 deletions(-)
 delete mode 100755 format.sh

diff --git a/format.sh b/format.sh
deleted file mode 100755
index a254f4842a..0000000000
--- a/format.sh
+++ /dev/null
@@ -1,91 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-command_exists ()
-{
-    type "$1" &> /dev/null ;
-}
-
-CFVERSION="9"
-CLANGFORMAT=""
-if command_exists clang-format-${CFVERSION}; then
-    CLANGFORMAT=clang-format-${CFVERSION}
-else
-    if command_exists clang-format; then
-        CLANGFORMAT=clang-format
-    fi
-fi
-
-if ! command -v $CLANGFORMAT &> /dev/null; then
-    echo "Required version of clang-format not found"
-    exit 1
-fi
-
-format_file()
-{
-    if [ -f "${1}" ]; then
-        $CLANGFORMAT -i -style=file "${1}" || true
-    fi
-}
-
-format_files()
-{
-    for file in $1; do
-        echo -ne "Formatting: ${file}\\033[0K\\r"
-        format_file "${file}"
-    done
-}
-
-exit_if_no_files()
-{
-    echo No files to format
-    exit 0
-}
-
-install_hook()
-{
-    # check for lone repo ring-daemon
-    hooks_path=".git/hooks"
-    if [ ! -d "$hooks_path=" ]; then
-        # or ring-project
-        hooks_path="../.git/modules/daemon/hooks"
-        if [ ! -d "$hooks_path" ]; then
-            echo "Can't find a git directory"
-            exit 1
-        fi
-    fi
-    echo Installing pre-commit hook in "$hooks_path"
-    echo "/bin/bash $0" > "$hooks_path"/pre-commit
-    chmod +x "$hooks_path"/pre-commit
-}
-
-display_help()
-{
-    echo "Usage: $0 [OPTION...] -- Clang format source files with a .clang-format file" >&2
-    echo
-    echo "   --all           format all files instead of only committed ones"
-    echo "   --install       install a pre-commit hook to run this script"
-    echo
-}
-
-if [ "$1" == "--help" ]; then
-    display_help
-    exit 0
-fi
-
-case "${1}" in
-  --all )
-    files=$(find src -regex '.*\.\(cpp\|hpp\|cc\|cxx\|h\)') || true
-    echo Formatting all source files...
-    format_files "$files"
-    ;;
-  --install )
-    install_hook
-    ;;
-  * )
-    files=$(git diff-index --cached --name-only HEAD | grep -iE '\.(cpp|cxx|cc|h|hpp)') || exit_if_no_files
-    echo Formatting committed source files...
-    format_files "$files"
-    ;;
-esac
-- 
GitLab