diff options
author | Francis Lavoie <lavofr@gmail.com> | 2021-10-18 14:19:04 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-10-18 12:19:04 -0600 |
commit | 062657d0d80aa1c2e3af51414db634f49c9a03a0 (patch) | |
tree | d235ee50728667f69ce584b0466a0694b7d5f50e /cmd/commandfuncs.go | |
parent | b092061591d673d5a886881531df2b39cd7722e3 (diff) |
caddycmd: Add `--skip-standard` to `list-modules` command, quieter output (#4386)
* caddycmd: Add --skip-standard to list-modules command, quieter output
* caddycmd: Also quiet `caddy upgrade` output, redundant information
Diffstat (limited to 'cmd/commandfuncs.go')
-rw-r--r-- | cmd/commandfuncs.go | 20 |
1 files changed, 14 insertions, 6 deletions
diff --git a/cmd/commandfuncs.go b/cmd/commandfuncs.go index cc3f65c..bc62f28 100644 --- a/cmd/commandfuncs.go +++ b/cmd/commandfuncs.go @@ -360,6 +360,7 @@ func cmdBuildInfo(fl Flags) (int, error) { func cmdListModules(fl Flags) (int, error) { packages := fl.Bool("packages") versions := fl.Bool("versions") + skipStandard := fl.Bool("skip-standard") printModuleInfo := func(mi moduleInfo) { fmt.Print(mi.caddyModuleID) @@ -388,14 +389,19 @@ func cmdListModules(fl Flags) (int, error) { return caddy.ExitCodeSuccess, nil } - if len(standard) > 0 { - for _, mod := range standard { - printModuleInfo(mod) + // Standard modules (always shipped with Caddy) + if !skipStandard { + if len(standard) > 0 { + for _, mod := range standard { + printModuleInfo(mod) + } } + fmt.Printf("\n Standard modules: %d\n", len(standard)) } - fmt.Printf("\n Standard modules: %d\n", len(standard)) + + // Non-standard modules (third party plugins) if len(nonstandard) > 0 { - if len(standard) > 0 { + if len(standard) > 0 && !skipStandard { fmt.Println() } for _, mod := range nonstandard { @@ -403,8 +409,10 @@ func cmdListModules(fl Flags) (int, error) { } } fmt.Printf("\n Non-standard modules: %d\n", len(nonstandard)) + + // Unknown modules (couldn't get Caddy module info) if len(unknown) > 0 { - if len(standard) > 0 || len(nonstandard) > 0 { + if (len(standard) > 0 && !skipStandard) || len(nonstandard) > 0 { fmt.Println() } for _, mod := range unknown { |