MCPcopy
hub / github.com/dnote/dnote / main

Function main

pkg/cli/main.go:61–89  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59}
60
61func main() {
62 // Parse flags early to get --dbPath before initializing database
63 // We need to manually parse --dbPath because it can appear after the subcommand
64 // (e.g., "dnote sync --full --dbPath=./custom.db") and root.ParseFlags only
65 // parses flags before the subcommand.
66 dbPath := parseDBPath(os.Args[1:])
67
68 // Initialize context - defaultAPIEndpoint is used when creating new config file
69 ctx, err := infra.Init(versionTag, apiEndpoint, dbPath)
70 if err != nil {
71 panic(errors.Wrap(err, "initializing context"))
72 }
73 defer ctx.DB.Close()
74
75 root.Register(remove.NewCmd(*ctx))
76 root.Register(edit.NewCmd(*ctx))
77 root.Register(login.NewCmd(*ctx))
78 root.Register(logout.NewCmd(*ctx))
79 root.Register(add.NewCmd(*ctx))
80 root.Register(sync.NewCmd(*ctx))
81 root.Register(version.NewCmd(*ctx))
82 root.Register(view.NewCmd(*ctx))
83 root.Register(find.NewCmd(*ctx))
84
85 if err := root.Execute(); err != nil {
86 log.Errorf("%s\n", err.Error())
87 os.Exit(1)
88 }
89}

Callers

nothing calls this directly

Calls 15

InitFunction · 0.92
RegisterFunction · 0.92
NewCmdFunction · 0.92
NewCmdFunction · 0.92
NewCmdFunction · 0.92
NewCmdFunction · 0.92
NewCmdFunction · 0.92
NewCmdFunction · 0.92
NewCmdFunction · 0.92
NewCmdFunction · 0.92
NewCmdFunction · 0.92
ExecuteFunction · 0.92

Tested by

no test coverage detected