From 80ecb958951783eb03e23a81800102d0e33db6e1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bj=C3=B8rn=20Erik=20Pedersen?= Date: Thu, 29 Jun 2023 08:53:50 +0200 Subject: commands: Handle hugo mod get --help Fixes #11141 --- commands/mod.go | 2 +- testscripts/commands/mod.txt | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/commands/mod.go b/commands/mod.go index 36d4a5596..55b8a8e08 100644 --- a/commands/mod.go +++ b/commands/mod.go @@ -224,7 +224,7 @@ Run "go help get" for more information. All flags available for "go get" is also run: func(ctx context.Context, cd *simplecobra.Commandeer, r *rootCommand, args []string) error { // We currently just pass on the flags we get to Go and // need to do the flag handling manually. - if len(args) == 1 && args[0] == "-h" { + if len(args) == 1 && args[0] == "-h" || args[0] == "--help" { return errHelp } diff --git a/testscripts/commands/mod.txt b/testscripts/commands/mod.txt index a2ea0ad24..56cea2c00 100644 --- a/testscripts/commands/mod.txt +++ b/testscripts/commands/mod.txt @@ -22,6 +22,10 @@ stdout 'Deleted 2\d{2} files from module cache\.' cd submod hugo mod init testsubmod cmpenv go.mod $WORK/golden/go.mod.testsubmod +hugo mod get -h +stdout 'hugo mod get \[flags\] \[args\]' +hugo mod get --help +stdout 'hugo mod get \[flags\] \[args\]' -- hugo.toml -- title = "Hugo Modules Test" [module] -- cgit v1.2.3