diff --git a/contactsmenu.sh b/contactsmenu.sh index d6c66c4..3cfbf63 100644 --- a/contactsmenu.sh +++ b/contactsmenu.sh @@ -12,19 +12,13 @@ read -r CONTATCS if [ "$CONTATCS" = "1" ] then - echo "WIP" - sleep 2 - source conactsmenu.sh source listcontacts.sh elif [ "$CONTATCS" = "2" ] then source addcontact-menu.sh elif [ "$CONTATCS" = "3" ] then - echo "WIP" - sleep 2 - source conactsmenu.sh - source delete contact.sh + source deletecontact.sh elif [ "$CONTATCS" = "4" ] then source mainmenu.sh diff --git a/deletecontact.sh b/deletecontact.sh new file mode 100644 index 0000000..e756199 --- /dev/null +++ b/deletecontact.sh @@ -0,0 +1,17 @@ + + +printf "Enter Contact ID: " +read -r CONATACT_ID +DELETESUCCESS=$(curl -s -b $COOKIE $BML_URL/contacts/$CONATACT_ID \ + --data-raw _method=delete \ + --compressed \ + | jq -r .code) + +if [ "$DELETESUCCESS" = "0" ] +then + echo Contact Deleted + source contactsmenu.sh +else + echo "${red}There was an error${reset}" + source contactsmenu.sh +fi diff --git a/listcontacts.sh b/listcontacts.sh index f517801..ec58136 100644 --- a/listcontacts.sh +++ b/listcontacts.sh @@ -1,3 +1,3 @@ curl -s -b $COOKIE $BML_URL/contacts \ -| jq -r '["Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.account, .currency, .name, .alias]) | @tsv' +| jq -r '["ID","Account Number","Currency","Account Name","Contact Name"], ["==================================================================="], (.["payload"] | .[] | [.id, .account, .currency, .name, .alias]) | @tsv' source contactsmenu.sh diff --git a/readpass.sh b/readpass.sh index ee40614..4166da6 100644 --- a/readpass.sh +++ b/readpass.sh @@ -3,7 +3,7 @@ then source $CREDENTIALS if [ "$LOGIN" = "2" ] then - echo "${red}Password update required${reset}" + echo "${red}Login Required${reset}" rm $CREDENTIALS 2> /dev/null read -p 'Username: ' BML_USERNAME read -s -p 'Password: ' BML_PASSWORD @@ -13,7 +13,7 @@ then fi elif [ ! -f $CREDENTIALS ] then - echo "${red}Username or Password in correct${reset}" + echo "${red}Login Required${reset}" read -p 'Username: ' BML_USERNAME read -s -p 'Password: ' BML_PASSWORD echo ""