refactor: updated cmd command funcs
This commit is contained in:
parent
a1a9c6407f
commit
1413312893
6 changed files with 63 additions and 1 deletions
|
|
@ -1,7 +1,19 @@
|
||||||
package cmd
|
package cmd
|
||||||
|
|
||||||
import "github.com/spf13/cobra"
|
import (
|
||||||
|
"git.towk2.me/towk/configurator/pkg/util"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
var downloadCmd = cobra.Command{
|
var downloadCmd = cobra.Command{
|
||||||
Use: "download",
|
Use: "download",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
|
util.MakeRequest()
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(&downloadCmd)
|
||||||
}
|
}
|
||||||
|
|
|
||||||
10
cmd/list.go
10
cmd/list.go
|
|
@ -0,0 +1,10 @@
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import "github.com/spf13/cobra"
|
||||||
|
|
||||||
|
var listCmd = &cobra.Command{
|
||||||
|
Use: "list",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
@ -0,0 +1,10 @@
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import "github.com/spf13/cobra"
|
||||||
|
|
||||||
|
var profilesCmd = &cobra.Command{
|
||||||
|
Use: "profiles",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
10
cmd/run.go
Normal file
10
cmd/run.go
Normal file
|
|
@ -0,0 +1,10 @@
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import "github.com/spf13/cobra"
|
||||||
|
|
||||||
|
var runCmd = &cobra.Command{
|
||||||
|
Use: "run",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
20
cmd/serve.go
Normal file
20
cmd/serve.go
Normal file
|
|
@ -0,0 +1,20 @@
|
||||||
|
package cmd
|
||||||
|
|
||||||
|
import (
|
||||||
|
"git.towk2.me/towk/configurator/pkg/service"
|
||||||
|
"github.com/rs/zerolog/log"
|
||||||
|
"github.com/spf13/cobra"
|
||||||
|
)
|
||||||
|
|
||||||
|
var serveCmd = &cobra.Command{
|
||||||
|
Use: "serve",
|
||||||
|
Run: func(cmd *cobra.Command, args []string) {
|
||||||
|
server := service.New()
|
||||||
|
err := server.Serve()
|
||||||
|
log.Error().Err(err).Msg("server closed")
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
func init() {
|
||||||
|
rootCmd.AddCommand(serveCmd)
|
||||||
|
}
|
||||||
Loading…
Add table
Add a link
Reference in a new issue