-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.go
More file actions
53 lines (45 loc) · 1.23 KB
/
main.go
File metadata and controls
53 lines (45 loc) · 1.23 KB
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package main
import (
"fmt"
"os"
"github.com/neongreen/mono/want/cmd"
)
func main() {
// Wire up the handlers
// Wrap getCompoundHandler to match the expected type
getCompoundHandlerWrapped := func(s string) (cmd.CompoundHandlerFunc, bool) {
handler, ok := getCompoundHandler(s)
if !ok {
return nil, false
}
// Convert CompoundHandler to CompoundHandlerFunc
return cmd.CompoundHandlerFunc(handler), true
}
// Wrap handler functions to return errors
handleJsonCommandWrapped := func(args []string, dryRun bool, planJSON bool) error {
handleJsonCommand(args, dryRun, planJSON)
return nil
}
handleMarkdownCommandWrapped := func(args []string, dryRun bool, planJSON bool) error {
handleMarkdownCommand(args, dryRun, planJSON)
return nil
}
handleExcalifontCommandWrapped := func(args []string, dryRun bool, planJSON bool) error {
handleExcalifontCommand(args, dryRun, planJSON)
return nil
}
cmd.SetHandlers(
listMonoReleases,
installMonoRelease,
getCompoundHandlerWrapped,
handleGitHubAsset,
installToolViaMise,
handleJsonCommandWrapped,
handleMarkdownCommandWrapped,
handleExcalifontCommandWrapped,
)
if err := cmd.Execute(); err != nil {
fmt.Fprintf(os.Stderr, "Error: %v\n", err)
os.Exit(1)
}
}