github.com/vishnupahwa/lakctl@v0.0.2-alpha/cmd/commands/options/server.go (about) 1 package options 2 3 import ( 4 "github.com/spf13/cobra" 5 "strconv" 6 ) 7 8 // Server struct contains server options for the controlling HTTP server. 9 type Server struct { 10 Port int 11 } 12 13 func AddServerArgs(cmd *cobra.Command, s *Server) { 14 cmd.Flags().IntVarP(&s.Port, "port", "p", 8008, 15 "Port to use for HTTP control server") 16 } 17 18 func (s *Server) PortStr() string { 19 return strconv.Itoa(s.Port) 20 }