~timharek/sbanken.sh

01a622000cd0c5b1c924f61ab1d70b32e550e838 — Tim Hårek Andreassen 2 years ago 64811ab main
Add option to get primary account

Signed-off-by: Tim Hårek Andreassen <tim@harek.dev>
1 files changed, 11 insertions(+), 1 deletions(-)

M sbanken.sh
M sbanken.sh => sbanken.sh +11 -1
@@ 20,6 20,7 @@ displayHelp() {
  echo "ARGUMENTS:"
  echo "  -h, --help      Print Help (this message)"
  echo "  -a, --accounts  Returns all available accounts"
  echo "  -A              Returns primary account"
  echo "  -c, --cards     Returns all available cards"
  echo "  -e, --efaktura  Returns all available cards"
  echo


@@ 133,7 134,7 @@ getEfaktura() {

verbose='false'

while getopts 'acetvh' flag; do
while getopts 'Aacetvh' flag; do
  case "${flag}" in
    a)  getToken 
        eval nextopt=\${$OPTIND}


@@ 145,6 146,15 @@ while getopts 'acetvh' flag; do
        else
          getAccounts
        fi ;;
    A)  if [[ -n $primaryAccount ]] ; then
          echo $primaryAccount
          enteredAccountId=$primaryAccount
          getToken
          getAccount
        else
          echo "Missing primaryAccount from config"
          displayHelp
        fi ;;
    c)  getToken
        getCards ;;
    e)  getToken