MCPcopy
hub / github.com/rubenv/sql-migrate / realMain

Function realMain

sql-migrate/main.go:16–54  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

14var ui cli.Ui
15
16func realMain() int {
17 ui = &cli.BasicUi{Writer: os.Stdout, ErrorWriter: os.Stderr}
18
19 cli := &cli.CLI{
20 Args: os.Args[1:],
21 Commands: map[string]cli.CommandFactory{
22 "up": func() (cli.Command, error) {
23 return &UpCommand{}, nil
24 },
25 "down": func() (cli.Command, error) {
26 return &DownCommand{}, nil
27 },
28 "redo": func() (cli.Command, error) {
29 return &RedoCommand{}, nil
30 },
31 "status": func() (cli.Command, error) {
32 return &StatusCommand{}, nil
33 },
34 "new": func() (cli.Command, error) {
35 return &NewCommand{}, nil
36 },
37 "skip": func() (cli.Command, error) {
38 return &SkipCommand{}, nil
39 },
40 },
41 HelpFunc: cli.BasicHelpFunc("sql-migrate"),
42 HelpWriter: os.Stdout,
43 ErrorWriter: os.Stderr,
44 Version: GetVersion(),
45 }
46
47 exitCode, err := cli.Run()
48 if err != nil {
49 _, _ = fmt.Fprintf(os.Stderr, "Error executing CLI: %s\n", err.Error())
50 return 1
51 }
52
53 return exitCode
54}

Callers 1

mainFunction · 0.85

Calls 3

GetVersionFunction · 0.85
RunMethod · 0.45
ErrorMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…