github.com/scaleway/scaleway-cli@v1.11.1/pkg/commands/logout.go (about) 1 // Copyright (C) 2015 Scaleway. All rights reserved. 2 // Use of this source code is governed by a MIT-style 3 // license that can be found in the LICENSE.md file. 4 5 package commands 6 7 import ( 8 "fmt" 9 "os" 10 11 "github.com/scaleway/scaleway-cli/pkg/config" 12 ) 13 14 // LogoutArgs are flags for the `RunLogout` function 15 type LogoutArgs struct{} 16 17 // RunLogout is the handler for 'scw logout' 18 func RunLogout(ctx CommandContext, args LogoutArgs) error { 19 // FIXME: ask if we need to remove the local ssh key on the account 20 scwrcPath, err := config.GetConfigFilePath() 21 if err != nil { 22 return fmt.Errorf("unable to get scwrc config file path: %v", err) 23 } 24 25 if _, err = os.Stat(scwrcPath); err == nil { 26 err = os.Remove(scwrcPath) 27 if err != nil { 28 return fmt.Errorf("unable to remove scwrc config file: %v", err) 29 } 30 } 31 return nil 32 }