mirror of
https://github.com/tuxdotrs/trok.git
synced 2025-07-06 20:06:34 +05:30
feat: initial commit with cobra setup
This commit is contained in:
29
cmd/server.go
Normal file
29
cmd/server.go
Normal file
@ -0,0 +1,29 @@
|
||||
/*
|
||||
Copyright © 2024 tux <0xtux@pm.me>
|
||||
*/
|
||||
package cmd
|
||||
|
||||
import (
|
||||
"github.com/0xtux/trok/internal/server"
|
||||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
// serverCmd represents the server command
|
||||
var serverCmd = &cobra.Command{
|
||||
Use: "server",
|
||||
Short: "Initiates the remote proxy server",
|
||||
Long: "Initiates the remote proxy server",
|
||||
Run: func(cmd *cobra.Command, args []string) {
|
||||
port, err := cmd.Flags().GetUint16("port")
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
server.Start(port)
|
||||
},
|
||||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(serverCmd)
|
||||
|
||||
serverCmd.Flags().Uint16P("port", "p", 1421, "Port for the server to listen on")
|
||||
}
|
Reference in New Issue
Block a user