From bccc8424ed2fdb61c3843886266f11341ea61aa5 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 30 Oct 2018 11:57:43 +0100 Subject: [PATCH 1/3] [DEV] add color in the grep --- .bashrc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.bashrc b/.bashrc index b5b4b87..86ea6cb 100644 --- a/.bashrc +++ b/.bashrc @@ -31,6 +31,8 @@ alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' +alias grep='grep --color' + # some more ls aliases alias ll='ls -l --color -h' alias la='ls -la --color -h' From 0b453fef9e21244e8ef7a3cb1d339ac8e5ff1a36 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 30 Oct 2018 11:57:57 +0100 Subject: [PATCH 2/3] [DEV] add clang-format tools --- .bin/clang-format.py | 92 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 92 insertions(+) create mode 100755 .bin/clang-format.py diff --git a/.bin/clang-format.py b/.bin/clang-format.py new file mode 100755 index 0000000..5448d01 --- /dev/null +++ b/.bin/clang-format.py @@ -0,0 +1,92 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +## +## @author Edouard DUPIN +## +## @copyright 2016, Edouard DUPIN, all right reserved +## +## @license APACHE v2.0 (see license file) +## +import os +import fnmatch +import sys +import subprocess +import shlex +## +## @brief Execute the command with no get of output +## +def run_command(cmd_line): + # prepare command line: + args = shlex.split(cmd_line) + print("[INFO] cmd = " + str(args)) + try: + # create the subprocess + p = subprocess.Popen(args) + except subprocess.CalledProcessError as e: + print("[ERROR] subprocess.CalledProcessError : " + str(args)) + return False + #except: + # debug.error("Exception on : " + str(args)) + # launch the subprocess: + output, err = p.communicate() + # Check error : + if p.returncode == 0: + return True + else: + return False + + +## +## @brief Get list of all Files in a specific path (with a regex) +## @param[in] path (string) Full path of the machine to search files (start with / or x:) +## @param[in] regex (string) Regular expression to search data +## @param[in] recursive (bool) List file with recursive search +## @param[in] remove_path (string) Data to remove in the path +## @return (list) return files requested +## +def get_list_of_file_in_path(path, regex="*", recursive = True, remove_path=""): + out = [] + if os.path.isdir(os.path.realpath(path)): + tmp_path = os.path.realpath(path) + tmp_rule = regex + else: + debug.error("path does not exist : '" + str(path) + "'") + + for root, dirnames, filenames in os.walk(tmp_path): + deltaRoot = root[len(tmp_path):] + while len(deltaRoot) > 0 \ + and ( deltaRoot[0] == '/' \ + or deltaRoot[0] == '\\' ): + deltaRoot = deltaRoot[1:] + if recursive == False \ + and deltaRoot != "": + return out + tmpList = filenames + if len(tmp_rule) > 0: + tmpList = fnmatch.filter(filenames, tmp_rule) + # Import the module : + for cycleFile in tmpList: + #for cycleFile in filenames: + add_file = os.path.join(tmp_path, deltaRoot, cycleFile) + if len(remove_path) != 0: + if add_file[:len(remove_path)] != remove_path: + print("ERROR : Request remove start of a path that is not the same: '" + add_file[:len(remove_path)] + "' demand remove of '" + str(remove_path) + "'") + else: + add_file = add_file[len(remove_path)+1:] + out.append(add_file) + return out; + +list_files = get_list_of_file_in_path('.', "*.cpp") +list_files += get_list_of_file_in_path('.', "*.hpp") +list_files += get_list_of_file_in_path('.', "*.cxx") +list_files += get_list_of_file_in_path('.', "*.hxx") +list_files += get_list_of_file_in_path('.', "*.c") +list_files += get_list_of_file_in_path('.', "*.h") +list_files += get_list_of_file_in_path('.', "*.C") +list_files += get_list_of_file_in_path('.', "*.H") +#list_files += get_list_of_file_in_path('.', "*.qml") + +for elem in list_files: + print("format code: " + elem) + cmd_line = "clang-format -i " + elem.replace(" ", "\ ").replace("'", "\\'") + ret = run_command(cmd_line) From ec3b323fbbb758a3c3ecf115fae72e70d4449357 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Tue, 30 Oct 2018 11:58:22 +0100 Subject: [PATCH 3/3] add remplace in .qrc and .qml and .pro --- .bin/replaceSed.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.bin/replaceSed.sh b/.bin/replaceSed.sh index fc91174..7a7cdaa 100755 --- a/.bin/replaceSed.sh +++ b/.bin/replaceSed.sh @@ -14,7 +14,9 @@ listFiles+=" `find . -name "*.mm"` " listFiles+=" `find . -name "*.mk"` " listFiles+=" `find . -name "*.md"` " listFiles+=" `find . -name "*.js"` " - +listFiles+=" `find . -name "*.pro"` " +listFiles+=" `find . -name "*.qml"` " +listFiles+=" `find . -name "*.qrc"` " listFiles+=" `find . -name "*.py"` " echo "Replace : \"$1\" ==> \"$2\""