github.com/jcarley/cli@v0.0.0-20180201210820-966d90434c30/commands/clear/clear.go (about) 1 package clear 2 3 import ( 4 "github.com/Sirupsen/logrus" 5 "github.com/daticahealth/cli/config" 6 "github.com/daticahealth/cli/models" 7 ) 8 9 func CmdClear(privateKey, session, environments, pods bool, settings *models.Settings) error { 10 if privateKey { 11 settings.PrivateKeyPath = "" 12 } 13 if session { 14 settings.SessionToken = "" 15 settings.UsersID = "" 16 } 17 if environments { 18 settings.Environments = map[string]models.AssociatedEnvV2{} 19 } 20 if pods { 21 settings.Pods = &[]models.Pod{} 22 } 23 config.SaveSettings(settings) 24 if !privateKey && !session && !environments && !pods { 25 logrus.Println("No settings were specified. To see available options, run \"datica clear --help\"") 26 } else { 27 logrus.Println("All specified settings have been cleared") 28 } 29 return nil 30 }