Commit ce978dbd authored by Aral Balkan's avatar Aral Balkan

Fixed log-out. Added log-out help. Updated log-in with fixes. Closes #2.

parent 3d4bd07c
Pipeline #484 skipped
...@@ -30,25 +30,11 @@ set -e ...@@ -30,25 +30,11 @@ set -e
# #
################################################################################ ################################################################################
# showUsage(){
# Ensure arguments echo "\nUsage: better/log-in <privateToken>\n"
# echo "You can get your private token from https://source.ind.ie/profile/account\n"
if [ -z $1 ]; then
# Check if logged in.
privateTokenFile=~/better.fyi/.private/config/source.ind.ie-private-token
if [ -f $privateTokenFile ]; then
privateToken=$(cat $privateTokenFile)
echo "\n ✓ Already logged in with private token ${privateToken}.\n"
else
echo "\nUsage: better/log-in <privateToken>\n"
echo "You can get your private token from https://source.ind.ie/profile/account\n"
fi
exit 0 exit 0
fi }
privateToken=$1
privateTokenFile=~/better.fyi/.private/config/source.ind.ie-private-token
logIn(){ logIn(){
if [ -f $privateTokenFile ]; then if [ -f $privateTokenFile ]; then
...@@ -101,4 +87,28 @@ main(){ ...@@ -101,4 +87,28 @@ main(){
goodbye goodbye
} }
#
# Ensure arguments
#
if [ "$1" == "--help" ]; then
showUsage
fi
privateToken=$1
privateTokenFile=~/better.fyi/.private/config/source.ind.ie-private-token
if [ -z $1 ]; then
# Check if logged in.
if [ -f $privateTokenFile ]; then
privateToken=$(cat $privateTokenFile)
echo "\n ✓ Already logged in with private token ${privateToken}.\n"
else
showUsage
fi
exit 0
fi
main main
...@@ -24,7 +24,7 @@ logOut(){ ...@@ -24,7 +24,7 @@ logOut(){
privateTokenFile=~/better.fyi/.private/config/source.ind.ie-private-token privateTokenFile=~/better.fyi/.private/config/source.ind.ie-private-token
if [ -f $privateTokenFile} ]; then if [ -f $privateTokenFile ]; then
existingPrivateToken=$(cat $privateTokenFile) existingPrivateToken=$(cat $privateTokenFile)
...@@ -50,4 +50,9 @@ main(){ ...@@ -50,4 +50,9 @@ main(){
goodbye goodbye
} }
if [ "$1" == "--help" ]; then
echo "\nUsage: better/log-out Logs you out of source.ind.ie.\n"
exit 0
fi
main main
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment