From 7574108e9756429bab3b710915a8eefeffa4901b Mon Sep 17 00:00:00 2001 From: Shihaam Abdul Rahman Date: Fri, 21 May 2021 04:54:12 +0500 Subject: [PATCH] they call me the regex king --- bml-cli | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/bml-cli b/bml-cli index 1e1d615..765471c 100755 --- a/bml-cli +++ b/bml-cli @@ -470,8 +470,11 @@ api_activites(){ ################################################################################################ activities(){ echo Current Page: 1 - echo $API_ACTIVITES | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ - | sed "s/+05:00//g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + echo $API_ACTIVITES \ + | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["====","==========","=========","==========================","==============","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ + | sed "s/+05:00//g" \ + | sed 's/\([0-9]\{4\}-[0-9][0-9]-[0-9][0-9]\)T\([0-9][0-9]:[0-9][0-9]:[0-9][0-9]\)/\1 \2/g' \ + | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K while true; do echo "" echo Total Pages: $PAGETOTAL @@ -482,8 +485,10 @@ activities(){ display_banner && display_name && display_userinfo echo Current Page: $PAGENO curl -s -b $COOKIE $BML_URL/activities?page=$PAGENO \ - | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["=====","==========","=====","============","=======","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ - | sed "s/+05:00//g" | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K + | jq -r '["Type","Date","Time","Contact","Amount","Remarks","Status"], ["====","==========","=========","==========================","============","==================","==========="],(.payload | .content | .data | .[] | [.type, .datetime, .creditName, .formattedAmount, .message, .status]) | @tsv' \ + | sed "s/+05:00//g" \ + | sed 's/\([0-9]\{4\}-[0-9][0-9]-[0-9][0-9]\)T\([0-9][0-9]:[0-9][0-9]:[0-9][0-9]\)/\1 \2/g' \ + | perl -pe 's/((?<=\t)|(?<=^))\t/ \t/g;' "$@" | column -t -s $'\t' | exec less -F -S -X -K elif [ "$PAGENO" -gt "$PAGETOTAL" ] then display_banner && display_name && display_userinfo @@ -498,6 +503,7 @@ activities(){ echo Enter x to go back fi done + } services(){ echo ""