summaryrefslogtreecommitdiffstats
path: root/commands/server.go
diff options
context:
space:
mode:
authorDylan MacKenzie <dylanxmackenzie@gmail.com>2015-04-01 21:40:29 -0700
committerbep <bjorn.erik.pedersen@gmail.com>2015-04-02 12:52:08 +0200
commit99a18b21fcc2523015c071b8915cae00a83842b5 (patch)
tree28d6ace240d1c9813a661c4449dc4fb54f3fa6be /commands/server.go
parent72aa516c756510e19a19a81419879fb31e6952f1 (diff)
List directories being watched when server is run
Fixes part of issue 1030. Previously hugo only listed the content directory as being watched. Now we list all files being watched according to `commands.getDirList()`. We also introduce a RemoveSubpaths function and test in the helpers module to reduce noise in the command line output by not showing subdirectories of ones already being watched. For example, instead of: `Watching for changes in $HOME/blog/content` We get: `Watching for changes in $HOME/blog/{data,content,layouts,static,themes/my-theme}`
Diffstat (limited to 'commands/server.go')
-rw-r--r--commands/server.go9
1 files changed, 8 insertions, 1 deletions
diff --git a/commands/server.go b/commands/server.go
index 372a67c6b..5e682badc 100644
--- a/commands/server.go
+++ b/commands/server.go
@@ -98,7 +98,14 @@ func server(cmd *cobra.Command, args []string) {
// Watch runs its own server as part of the routine
if serverWatch {
- jww.FEEDBACK.Println("Watching for changes in", helpers.AbsPathify(viper.GetString("ContentDir")))
+ watched := getDirList()
+ workingDir := helpers.AbsPathify(viper.GetString("WorkingDir"))
+ for i, dir := range watched {
+ watched[i], _ = helpers.GetRelativePath(dir, workingDir)
+ }
+ unique := strings.Join(helpers.RemoveSubpaths(watched), ",")
+
+ jww.FEEDBACK.Printf("Watching for changes in %s/{%s}\n", workingDir, unique)
err := NewWatcher(serverPort)
if err != nil {
fmt.Println(err)