diff --git a/cmd/deleteUser.go b/cmd/deleteUser.go index 17c30c3..907f8b4 100644 --- a/cmd/deleteUser.go +++ b/cmd/deleteUser.go @@ -5,6 +5,7 @@ import ( "fmt" "os" + "github.com/logrusorgru/aurora" "github.com/mainawycliffe/kamanda/firebase/auth" "github.com/spf13/cobra" ) @@ -20,19 +21,15 @@ var deleteUserCmd = &cobra.Command{ fmt.Printf("atleast one Firebase user uid is required!") os.Exit(1) } - - // delete all user accounts + // delete all listed user accounts for _, uid := range args { - err := auth.DeleteFirebaseUser(context.Background(), uid) - if err != nil { - fmt.Printf("Error deleting %s: %s\n", uid, err.Error()) - os.Exit(1) + fmt.Print(aurora.Sprintf(aurora.Red("%s - Not Deleted: %s\n"), uid, err.Error())) + continue } + fmt.Print(aurora.Sprintf(aurora.Green("%s - Deleted\n"), uid)) } - - fmt.Printf("User was successfully deleted!") os.Exit(0) }, } diff --git a/go.mod b/go.mod index c84740a..6a643e5 100644 --- a/go.mod +++ b/go.mod @@ -10,6 +10,7 @@ require ( github.com/go-chi/chi v4.0.2+incompatible github.com/golang/groupcache v0.0.0-20191027212112-611e8accdfc9 // indirect github.com/joho/godotenv v1.3.0 + github.com/logrusorgru/aurora v0.0.0-20191116043053-66b7ad493a23 github.com/mitchellh/go-homedir v1.1.0 github.com/pelletier/go-toml v1.6.0 // indirect github.com/pkg/browser v0.0.0-20180916011732-0a3d74bf9ce4 diff --git a/go.sum b/go.sum index 483e144..669aacf 100644 --- a/go.sum +++ b/go.sum @@ -113,6 +113,8 @@ github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORN github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE= github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/logrusorgru/aurora v0.0.0-20191116043053-66b7ad493a23 h1:Wp7NjqGKGN9te9N/rvXYRhlVcrulGdxnz8zadXWs7fc= +github.com/logrusorgru/aurora v0.0.0-20191116043053-66b7ad493a23/go.mod h1:7rIyQOR62GCctdiQpZ/zOJlFyk6y+94wXzv6RNZgaR4= github.com/magiconair/properties v1.8.0/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ= github.com/magiconair/properties v1.8.1 h1:ZC2Vc7/ZFkGmsVC9KvOjumD+G5lXy2RtTKyzRKO2BQ4= github.com/magiconair/properties v1.8.1/go.mod h1:PppfXfuXeibc/6YijjN8zIbojt8czPbwD3XqdrwzmxQ=