-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmain.go
39 lines (31 loc) · 909 Bytes
/
main.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
package main
import (
"log"
"os"
"github.com/d4r1us-drk/clido/controllers"
"github.com/d4r1us-drk/clido/repository"
"github.com/d4r1us-drk/clido/views/cmd"
)
func run() int {
// Initialize the repository
repo, repoErr := repository.NewRepository()
if repoErr != nil {
log.Printf("Error initializing repository: %v", repoErr)
return 1 // Exit code 1 indicates failure
}
defer repo.Close()
// Initialize controllers
projectController := controllers.NewProjectController(repo)
taskController := controllers.NewTaskController(repo)
// Initialize the root command with controllers
rootCmd := cmd.NewRootCmd(projectController, taskController)
// Execute the root command
if err := rootCmd.Execute(); err != nil {
return 1 // Return 1 on error
}
return 0 // Exit code 0 indicates success
}
func main() {
// Call the run function and exit with the appropriate code
os.Exit(run())
}