Add clear command and get rid of the development flag

This commit is contained in:
khlieng 2015-05-02 01:02:21 +02:00
parent d1a82a65b5
commit 79095154ca
4 changed files with 40 additions and 20 deletions

View file

@ -20,15 +20,18 @@ var (
bucketMessages = []byte("Messages")
)
func Initialize(clean bool) {
var err error
currentUser, _ := user.Current()
appDir = path.Join(currentUser.HomeDir, ".name_pending")
if clean {
os.RemoveAll(appDir)
func init() {
currentUser, err := user.Current()
if err != nil {
log.Fatal(err)
}
appDir = path.Join(currentUser.HomeDir, ".name_pending")
}
func Initialize() {
var err error
os.Mkdir(appDir, 0777)
os.Mkdir(path.Join(appDir, "logs"), 0777)
@ -46,6 +49,10 @@ func Initialize(clean bool) {
})
}
func Cleanup() {
func Close() {
db.Close()
}
func Clear() {
os.RemoveAll(appDir)
}