-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.go
48 lines (43 loc) · 1017 Bytes
/
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
package main
import (
"fmt"
"os"
"github.com/deestarks/routnd/config"
"github.com/deestarks/routnd/internal/commands"
"github.com/spf13/cobra"
)
var rootCmd = &cobra.Command{
Use: "routnd",
Short: "Routnd runs processes in daemon mode",
Long: `Routnd is a command line tool for running processes in the background.`,
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}
func init() {
// Version
rootCmd.AddCommand(&cobra.Command{
Use: "version",
Short: "Print the version number of routnd",
Long: `All software has versions. This is routnd's`,
Run: func(cmd *cobra.Command, args []string) {
fmt.Println(config.New().Version)
},
})
// Start
rootCmd.AddCommand(commands.StartCmd)
// Stop
rootCmd.AddCommand(commands.StopCmd)
// Logs
rootCmd.AddCommand(commands.LogsCmd)
// List
rootCmd.AddCommand(commands.ListCmd)
// Status
rootCmd.AddCommand(commands.StatusCmd)
}
func main() {
if err := rootCmd.Execute(); err != nil {
fmt.Println(err)
os.Exit(1)
}
}