From 0506851cd6a19877f3e37fa28c23e0af4aa9a68f Mon Sep 17 00:00:00 2001 From: ArenaL5 Date: Thu, 5 Dec 2019 00:56:49 +0100 Subject: Improve adb.sh Adding support for -c flag. --- scripts/adb.sh | 20 ++++++++++++++++---- 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/scripts/adb.sh b/scripts/adb.sh index 16b10c60c..fa9e7ab30 100755 --- a/scripts/adb.sh +++ b/scripts/adb.sh @@ -1,12 +1,20 @@ #! /bin/bash -if (( $# != 1 )); then - echo "Syntax: adb.sh [E|W|I|D|V] +# Default flags +clearlogcat=0; +if [ "$1" == "-c" ]; then + clearlogcat=1 + shift +fi +if [ $# != 1 ]; then + echo "Syntax: adb.sh [-c] {E|W|I|D|V} - adb.sh outputs a logcat and filters out lines not related with this project. + adb.sh outputs the logcat to standard output and filters out lines not related with this project. \`dalvikvm\`, \`System.err\` and \`AndroidRuntime\` are included, as those are used to debug fatal crashes. - The only argument is the initial of your log priority. (Error/Warning/Info/Debug/Verbose)" + The only argument is the initial of your log priority. (Error/Warning/Info/Debug/Verbose) + + You can optionally add the \`-c\` flag to clear the logcat prior to printing new logcat lines." else # These variables are just to higlight text: color="\033[0;36m" @@ -14,6 +22,10 @@ else error="\033[0;31m" # Retrieving current working path oldpath="$(pwd)" + if [ $clearlogcat == 1 ]; then + echo -e "${color}Clearing${nocolor} last entries…" + adb logcat -c + fi echo -e "${color}Searching${nocolor} for tags in source code…" # cd project_root_folder # This will traverse from current folder to its parent folderwork until it finds a .git folder: -- cgit v1.2.3