Add command to log out

This commit is contained in:
Tulir Asokan
2018-05-10 15:47:24 +03:00
parent e42ce27e0a
commit 151141f288
5 changed files with 33 additions and 7 deletions

View File

@ -55,6 +55,17 @@ func (config *Config) Clear() {
os.RemoveAll(config.MediaDir)
}
func (config *Config) DeleteSession() {
if config.Session != nil {
os.Remove(config.Session.path)
config.Session = nil
}
os.RemoveAll(config.HistoryDir)
os.RemoveAll(config.MediaDir)
os.MkdirAll(config.HistoryDir, 0700)
os.MkdirAll(config.MediaDir, 0700)
}
// Load loads the config from config.yaml in the directory given to the config struct.
func (config *Config) Load() {
os.MkdirAll(config.Dir, 0700)