Changed port type from int to uint16
This commit is contained in:
parent
022b14bfa2
commit
0a546dd468
|
@ -22,9 +22,8 @@ Available Commands:
|
|||
version Print version
|
||||
|
||||
Flags:
|
||||
-f, --filter string only display images matching specified pattern (case-insensitive)
|
||||
-h, --help help for roulette
|
||||
-p, --port int port to listen on (default 8080)
|
||||
-p, --port uint16 port to listen on (default 8080)
|
||||
-r, --recursive recurse into subdirectories
|
||||
-v, --verbose log accessed files to stdout
|
||||
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var Port int
|
||||
var Port uint16
|
||||
var Recursive bool
|
||||
var Verbose bool
|
||||
|
||||
|
@ -31,7 +31,7 @@ func Execute() {
|
|||
}
|
||||
|
||||
func init() {
|
||||
rootCmd.Flags().IntVarP(&Port, "port", "p", 8080, "port to listen on")
|
||||
rootCmd.Flags().Uint16VarP(&Port, "port", "p", 8080, "port to listen on")
|
||||
rootCmd.Flags().BoolVarP(&Recursive, "recursive", "r", false, "recurse into subdirectories")
|
||||
rootCmd.Flags().BoolVarP(&Verbose, "verbose", "v", false, "log accessed files to stdout")
|
||||
rootCmd.Flags().SetInterspersed(true)
|
||||
|
|
|
@ -10,7 +10,7 @@ import (
|
|||
"github.com/spf13/cobra"
|
||||
)
|
||||
|
||||
var Version = "0.13.2"
|
||||
var Version = "0.13.3"
|
||||
|
||||
func init() {
|
||||
rootCmd.AddCommand(versionCmd)
|
||||
|
|
|
@ -320,7 +320,7 @@ func ServePage(args []string) error {
|
|||
http.Handle(PREFIX+"/", http.StripPrefix(PREFIX, serveStaticFileHandler(paths)))
|
||||
http.HandleFunc("/favicon.ico", doNothing)
|
||||
|
||||
err = http.ListenAndServe(":"+strconv.Itoa(Port), nil)
|
||||
err = http.ListenAndServe(":"+strconv.FormatInt(int64(Port), 10), nil)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue