@@ -29,6 +29,64 @@ type Config struct {
2929 externalSlog bool
3030}
3131
32+ func DefaultEngineConfig () Config {
33+ return Config {
34+ RootPath : "." ,
35+ LogLevel : "warn" ,
36+ Debounce : 1000 ,
37+ Ignore : Ignore {
38+ Dir : []string {".git" , ".idea" , ".node_modules" , "vendor" },
39+ File : []string {".DS_Store" , ".gitignore" , ".gitkeep" },
40+ IgnoreGit : true ,
41+ },
42+ ExecStruct : make ([]process.Execute , 0 ),
43+ }
44+ }
45+
46+ func (c * Config ) WithRootPath (path string ) * Config {
47+ c .RootPath = path
48+ return c
49+ }
50+
51+ func (c * Config ) WithLogLevel (level string ) * Config {
52+ c .LogLevel = level
53+ return c
54+ }
55+
56+ func (c * Config ) WithDebounce (value int ) * Config {
57+ c .Debounce = value
58+ return c
59+ }
60+
61+ func (c * Config ) WithIgnore (ignore Ignore ) * Config {
62+ c .Ignore = ignore
63+ return c
64+ }
65+
66+ func (c * Config ) WithIgnoreDirs (dir []string ) * Config {
67+ c .Ignore .Dir = dir
68+ return c
69+ }
70+ func (c * Config ) WithIgnoreFiles (files []string ) * Config {
71+ c .Ignore .File = files
72+ return c
73+ }
74+
75+ func (c * Config ) WithIgnoreGit (truthy bool ) * Config {
76+ c .Ignore .IgnoreGit = truthy
77+ return c
78+ }
79+
80+ func (c * Config ) WithWatchedExtensions (extensions []string ) * Config {
81+ c .Ignore .WatchedExten = extensions
82+ return c
83+ }
84+
85+ func (c * Config ) WithExecuteCommand (cmd process.Execute ) * Config {
86+ c .ExecStruct = append (c .ExecStruct , cmd )
87+ return c
88+ }
89+
3290// Reads a config.toml file and returns the engine
3391func (engine * Engine ) readConfigFile (path string ) (* Engine , error ) {
3492 if _ , err := toml .DecodeFile (path , & engine ); err != nil {
0 commit comments