Add attribute flag building and parsing (#1562)

This adds a few command sketches but that's not the main point of the PR
and filling those out will come in a different PR. This adds a new flag
type that can combine inputs to a single target slice, retaining the
ability to distinguish where it came from but also keep ordering across
different flag names. It also implements a function that does the
heuristic parsing with fallback.
This commit is contained in:
Jeff Mitchell authored and GitHub committed 2021-09-26 11:48:43 -04:00
1 parent 14cc97b645
commit a834a14785
16 files changed
+1166 -36

No files matched your search

@@ -0,0 +1,33 @@
package hostcatalogscmd
import (
"github.com/hashicorp/boundary/internal/cmd/base"
)
func (c *PluginCommand) extraPluginHelpFunc(helpMap map[string]func() string) string {
var helpStr string
switch c.Func {
case "create":
helpStr = base.WrapForHelpText([]string{
"Usage: boundary host-catalogs create plugin [options] [args]",
"",
" Create a plugin-type host catalog. Example:",
"",
` $ boundary host-catalogs create plugin -scope-id p_1234567890 -name prodops -description "Plugin host-catalog for ProdOps"`,
"",
"",
})
case "update":
helpStr = base.WrapForHelpText([]string{
"Usage: boundary host-catalogs update plugin [options] [args]",
"",
" Update a plugin-type host catalog given its ID. Example:",
"",
` $ boundary host-catalogs update plugin -id hc_1234567890 -name "devops" -description "Plugin host-catalog for DevOps"`,
"",
"",
})
}
return helpStr + c.Flags().Help()
}