summaryrefslogtreecommitdiffstats
path: root/commands/mod.go
diff options
context:
space:
mode:
authorBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-28 10:44:40 +0200
committerBjørn Erik Pedersen <bjorn.erik.pedersen@gmail.com>2023-05-28 12:55:44 +0200
commit43f1282e734f5a27f99ff6efb29190a234b3447a (patch)
tree0e58d06118a6d13c93fed23baa13563fd3da2395 /commands/mod.go
parente96cdfe9664cb38c3e16cc00cc630cf6f258d547 (diff)
commands: Reinstate some of the removed build flags (e.g. --theme) to new and mod
Fixes #11018
Diffstat (limited to 'commands/mod.go')
-rw-r--r--commands/mod.go23
1 files changed, 19 insertions, 4 deletions
diff --git a/commands/mod.go b/commands/mod.go
index 1af1f7431..36d4a5596 100644
--- a/commands/mod.go
+++ b/commands/mod.go
@@ -61,6 +61,9 @@ This command is marked as 'Experimental'. We think it's a great idea, so it's no
removed from Hugo, but we need to test this out in "real life" to get a feel of it,
so this may/will change in future versions of Hugo.
`,
+ withc: func(cmd *cobra.Command, r *rootCommand) {
+ applyLocalFlagsBuildConfig(cmd, r)
+ },
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
h, err := r.Hugo(flagsToCfg(cd, nil))
if err != nil {
@@ -85,6 +88,9 @@ so this may/will change in future versions of Hugo.
Note that Hugo Modules supports multi-module projects, so you can initialize a Hugo Module
inside a subfolder on GitHub, as one example.
`,
+ withc: func(cmd *cobra.Command, r *rootCommand) {
+ applyLocalFlagsBuildConfig(cmd, r)
+ },
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
h, err := r.Hugo(flagsToCfg(cd, nil))
if err != nil {
@@ -101,7 +107,8 @@ so this may/will change in future versions of Hugo.
name: "verify",
short: "Verify dependencies.",
long: `Verify checks that the dependencies of the current module, which are stored in a local downloaded source cache, have not been modified since being downloaded.`,
- withc: func(cmd *cobra.Command) {
+ withc: func(cmd *cobra.Command, r *rootCommand) {
+ applyLocalFlagsBuildConfig(cmd, r)
cmd.Flags().BoolVarP(&clean, "clean", "", false, "delete module cache for dependencies that fail verification")
},
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
@@ -119,7 +126,8 @@ so this may/will change in future versions of Hugo.
long: `Print a module dependency graph with information about module status (disabled, vendored).
Note that for vendored modules, that is the version listed and not the one from go.mod.
`,
- withc: func(cmd *cobra.Command) {
+ withc: func(cmd *cobra.Command, r *rootCommand) {
+ applyLocalFlagsBuildConfig(cmd, r)
cmd.Flags().BoolVarP(&clean, "clean", "", false, "delete module cache for dependencies that fail verification")
},
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
@@ -135,7 +143,8 @@ Note that for vendored modules, that is the version listed and not the one from
name: "clean",
short: "Delete the Hugo Module cache for the current project.",
long: `Delete the Hugo Module cache for the current project.`,
- withc: func(cmd *cobra.Command) {
+ withc: func(cmd *cobra.Command, r *rootCommand) {
+ applyLocalFlagsBuildConfig(cmd, r)
cmd.Flags().StringVarP(&pattern, "pattern", "", "", `pattern matching module paths to clean (all if not set), e.g. "**hugo*"`)
cmd.Flags().BoolVarP(&all, "all", "", false, "clean entire module cache")
},
@@ -157,6 +166,9 @@ Note that for vendored modules, that is the version listed and not the one from
&simpleCommand{
name: "tidy",
short: "Remove unused entries in go.mod and go.sum.",
+ withc: func(cmd *cobra.Command, r *rootCommand) {
+ applyLocalFlagsBuildConfig(cmd, r)
+ },
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
h, err := r.Hugo(flagsToCfg(cd, nil))
if err != nil {
@@ -171,6 +183,9 @@ Note that for vendored modules, that is the version listed and not the one from
long: `Vendor all module dependencies into the _vendor directory.
If a module is vendored, that is where Hugo will look for it's dependencies.
`,
+ withc: func(cmd *cobra.Command, r *rootCommand) {
+ applyLocalFlagsBuildConfig(cmd, r)
+ },
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {
h, err := r.Hugo(flagsToCfg(cd, nil))
if err != nil {
@@ -203,7 +218,7 @@ Install the latest versions of all module dependencies:
Run "go help get" for more information. All flags available for "go get" is also relevant here.
` + commonUsageMod,
- withc: func(cmd *cobra.Command) {
+ withc: func(cmd *cobra.Command, r *rootCommand) {
cmd.DisableFlagParsing = true
},
run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error {