github.com/Benchkram/bob@v0.0.0-20220321080157-7c8f3876e225/bob/init.go (about) 1 package bob 2 3 import ( 4 "path/filepath" 5 6 "github.com/Benchkram/errz" 7 8 "github.com/Benchkram/bob/bob/global" 9 "github.com/Benchkram/bob/pkg/file" 10 ) 11 12 func (b *B) Init() (err error) { 13 //b := new() 14 return b.init() 15 } 16 17 func (b *B) init() (err error) { 18 defer errz.Recover(&err) 19 20 dir := filepath.Join(b.dir, global.BobWorkspaceFile) 21 22 if file.Exists(dir) { 23 return ErrWorkspaceAlreadyInitialised 24 } 25 26 err = b.write() 27 errz.Fatal(err) 28 29 return nil 30 }