mirror of
https://github.com/memohai/Memoh.git
synced 2026-04-25 07:00:48 +09:00
49 lines
909 B
Go
49 lines
909 B
Go
package main
|
|
|
|
import (
|
|
"os"
|
|
|
|
"github.com/spf13/cobra"
|
|
)
|
|
|
|
func main() {
|
|
rootCmd := &cobra.Command{
|
|
Use: "memoh",
|
|
Short: "Memoh unified binary",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
runServe()
|
|
return nil
|
|
},
|
|
}
|
|
|
|
rootCmd.AddCommand(&cobra.Command{
|
|
Use: "serve",
|
|
Short: "Start the server",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
runServe()
|
|
return nil
|
|
},
|
|
})
|
|
|
|
rootCmd.AddCommand(&cobra.Command{
|
|
Use: "migrate <up|down|version|force N>",
|
|
Short: "Run database migrations",
|
|
Args: cobra.MinimumNArgs(1),
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return runMigrate(args)
|
|
},
|
|
})
|
|
|
|
rootCmd.AddCommand(&cobra.Command{
|
|
Use: "version",
|
|
Short: "Print version information",
|
|
RunE: func(cmd *cobra.Command, args []string) error {
|
|
return runVersion()
|
|
},
|
|
})
|
|
|
|
if err := rootCmd.Execute(); err != nil {
|
|
os.Exit(1)
|
|
}
|
|
}
|