Add status and say to cobra
This commit is contained in:
15
main.go
15
main.go
@@ -53,6 +53,19 @@ var shellCmd = &cobra.Command{
|
|||||||
Args: cobra.ExactArgs(1),
|
Args: cobra.ExactArgs(1),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var sayCmd = &cobra.Command{
|
||||||
|
Use: "say",
|
||||||
|
Short: "Say something in the server",
|
||||||
|
Run: server.Say,
|
||||||
|
Args: cobra.MinimumNArgs(1),
|
||||||
|
}
|
||||||
|
|
||||||
|
var statusCMd = &cobra.Command{
|
||||||
|
Use: "cmd",
|
||||||
|
Short: "Get the status of the server",
|
||||||
|
Run: server.Status,
|
||||||
|
}
|
||||||
|
|
||||||
//go:embed templates/docker-compose.yml
|
//go:embed templates/docker-compose.yml
|
||||||
var dockerCompose string
|
var dockerCompose string
|
||||||
|
|
||||||
@@ -73,6 +86,8 @@ func init() {
|
|||||||
rootCmd.AddCommand(stopCmd)
|
rootCmd.AddCommand(stopCmd)
|
||||||
rootCmd.AddCommand(restartCmd)
|
rootCmd.AddCommand(restartCmd)
|
||||||
rootCmd.AddCommand(shellCmd)
|
rootCmd.AddCommand(shellCmd)
|
||||||
|
rootCmd.AddCommand(sayCmd)
|
||||||
|
rootCmd.AddCommand(statusCMd)
|
||||||
|
|
||||||
t, err := template.New("compose").Parse(dockerCompose)
|
t, err := template.New("compose").Parse(dockerCompose)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|||||||
Reference in New Issue
Block a user