/
main.go
38 lines (32 loc) · 918 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
package commands
import (
"github.com/millenc/latch-cmd/session"
"github.com/millenc/latch-cmd/util"
"github.com/spf13/cobra"
)
//Command session
var Session *session.LatchCmdSession = &session.LatchCmdSession{}
//Main command. Outputs help.
var MainCmd = &cobra.Command{
Use: "latch-cmd",
Short: "Latch-cmd is an unofficial command line tool that lets you interact with the Latch API (https://latch.elevenpaths.com/).",
Long: `Latch-cmd is an unofficial command line tool that lets you interact with the Latch API (https://latch.elevenpaths.com/).`,
Run: func(cmd *cobra.Command, args []string) {
cmd.Help()
},
}
//Adds commands and executes them
func Execute() {
AddCommands()
MainCmd.Execute()
}
//Adds subcommands to the root command
func AddCommands() {
MainCmd.AddCommand(AppCmd)
MainCmd.AddCommand(UserCmd)
MainCmd.AddCommand(AboutCmd)
}
//Init config
func init() {
util.InitConfig()
}