-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
65 lines (52 loc) · 1.48 KB
/
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
package main
import (
"fmt"
"os"
"github.com/radical-ui/flywheel/flutter"
"github.com/spf13/cobra"
)
func main() {
var logFile string
rootCmd := &cobra.Command{
Use: "flywheel",
Short: "An objection frontend, built with Flutter",
}
rootCmd.PersistentFlags().StringVarP(&logFile, "log-file", "l", "", "Write debug information to the specified logfile. Omitting or leaving empty will cause no logs to be written.")
genCommand := &cobra.Command{
Use: "gen",
Short: "Print the objects schema to stdout",
Run: func(cmd *cobra.Command, args []string) {
runWithErrorHandling(logFile, runOptions{
genBindings: true,
})
},
}
rootCmd.AddCommand(genCommand)
var displayName string
var url string
previewCommand := &cobra.Command{
Use: "preview [bundle identifier]",
Short: "Preview the application",
Run: func(cmd *cobra.Command, args []string) {
if len(args) == 0 {
fmt.Println("a bundle identifier argument is required")
os.Exit(1)
}
runWithErrorHandling(logFile, runOptions{
genFlutter: &flutter.Options{
DisplayName: displayName,
BundleIdentifier: args[0],
Url: url,
},
preview: true,
})
},
}
previewCommand.Flags().StringVar(&displayName, "display-name", "", "The application display name")
previewCommand.Flags().StringVar(&url, "url", "ws://localhost:8000", "The objection server to connect to")
rootCmd.AddCommand(previewCommand)
err := rootCmd.Execute()
if err != nil {
os.Exit(1)
}
}