commands: Make the hugo command non-global

See #4598
This commit is contained in:
Bjørn Erik Pedersen 2018-04-10 09:19:26 +02:00
parent 018602c46d
commit 4d32f2fa89
No known key found for this signature in database
GPG key ID: 330E6E2BD4859D8F
23 changed files with 299 additions and 336 deletions

View file

@ -15,6 +15,14 @@
// used by Hugo. Commands and flags are implemented using Cobra.
package commands
import (
"fmt"
"regexp"
"github.com/gohugoio/hugo/config"
"github.com/spf13/cobra"
)
const (
ansiEsc = "\u001B"
clearLine = "\r\033[K"
@ -22,6 +30,15 @@ const (
showCursor = ansiEsc + "[?25h"
)
type flagsToConfigHandler interface {
flagsToConfig(cfg config.Provider)
}
type cmder interface {
flagsToConfigHandler
getCommand() *cobra.Command
}
// commandError is an error used to signal different error situations in command handling.
type commandError struct {
s string