From: Krisztián Szabó Date: Sat, 28 Dec 2013 19:37:44 +0000 (+0100) Subject: Added append-port flag X-Git-Tag: v0.10~73 X-Git-Url: http://git.maquefel.me/?a=commitdiff_plain;h=5550c414;p=brevno-suite%2Fhugo Added append-port flag --- diff --git a/commands/server.go b/commands/server.go index b3d02642..cb33aedf 100644 --- a/commands/server.go +++ b/commands/server.go @@ -23,10 +23,12 @@ import ( var serverPort int var serverWatch bool +var serverAppend bool func init() { serverCmd.Flags().IntVarP(&serverPort, "port", "p", 1313, "port to run the server on") serverCmd.Flags().BoolVarP(&serverWatch, "watch", "w", false, "watch filesystem for changes and recreate as needed") + serverCmd.Flags().BoolVarP(&serverAppend, "append-port", "", true, "append port to baseurl") } var serverCmd = &cobra.Command{ @@ -49,7 +51,11 @@ func server(cmd *cobra.Command, args []string) { BaseUrl = "http://" + BaseUrl } - Config.BaseUrl = strings.TrimSuffix(BaseUrl, "/") + ":" + strconv.Itoa(serverPort) + if serverAppend { + Config.BaseUrl = strings.TrimSuffix(BaseUrl, "/") + ":" + strconv.Itoa(serverPort) + } else { + Config.BaseUrl = strings.TrimSuffix(BaseUrl, "/") + } build(serverWatch)