From b7bbce467b7f994cb1e9da5257dafa006c9510df Mon Sep 17 00:00:00 2001 From: Uwe Krueger Date: Fri, 16 Aug 2024 16:14:23 +0200 Subject: [PATCH] more path mappings (#877) #### What this PR does / why we need it: #### Which issue(s) this PR fixes: --------- Co-authored-by: Hilmar Falkenberg --- cmds/ocm/commands/toicmds/cmd.go | 8 ++++---- cmds/ocm/common/utils/command.go | 6 ++++-- docs/reference/ocm_toi.md | 10 +++++----- 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/cmds/ocm/commands/toicmds/cmd.go b/cmds/ocm/commands/toicmds/cmd.go index 9b3ec0e88d..bc5ff51a0f 100644 --- a/cmds/ocm/commands/toicmds/cmd.go +++ b/cmds/ocm/commands/toicmds/cmd.go @@ -21,13 +21,13 @@ func NewCommand(ctx clictx.Context) *cobra.Command { TOI is an abbreviation for (T)iny (O)CM (I)nstallation. It is a simple application framework on top of the Open Component Model, that can be used to describe image based installation executors and installation -packages (see topic ocm toi bootstrapping in form of resources +packages (see topic ocm toi-bootstrapping in form of resources with a dedicated type. All involved resources are hereby taken from a component version of the Open Component Model, which supports all the OCM features, like transportation. The framework consists of a generic bootstrap command -(ocm toi bootstrap componentversions) and an arbitrary set of image +(ocm bootstrap package) and an arbitrary set of image based executors, that are executed in containers and fed with the required installation data by th generic command. `, @@ -39,7 +39,7 @@ installation data by th generic command. cmd.AddCommand(bootstrap.NewCommand(ctx)) cmd.AddCommand(describe.NewCommand(ctx)) - cmd.AddCommand(topicocmrefs.New(ctx)) - cmd.AddCommand(topicbootstrap.New(ctx, "bootstrapping")) + cmd.AddCommand(utils.DocuCommandPath(topicocmrefs.New(ctx), "ocm")) + cmd.AddCommand(utils.DocuCommandPath(topicbootstrap.New(ctx, "bootstrapping"), "ocm", "toi-bootstrapping")) return cmd } diff --git a/cmds/ocm/common/utils/command.go b/cmds/ocm/common/utils/command.go index 07fd44cd1f..2cdba95667 100644 --- a/cmds/ocm/common/utils/command.go +++ b/cmds/ocm/common/utils/command.go @@ -5,6 +5,7 @@ import ( "strings" "github.com/mandelsoft/goutils/errors" + "github.com/mandelsoft/goutils/general" "github.com/spf13/cobra" "github.com/spf13/pflag" @@ -110,11 +111,12 @@ func OverviewCommand(cmd *cobra.Command) *cobra.Command { return cmd } -func DocuCommandPath(cmd *cobra.Command, path string) *cobra.Command { +func DocuCommandPath(cmd *cobra.Command, path string, optname ...string) *cobra.Command { + name := general.OptionalDefaulted(cmd.Name(), optname...) if cmd.Annotations == nil { cmd.Annotations = map[string]string{} } - cmd.Annotations["commandPath"] = path + " " + cmd.Name() + cmd.Annotations["commandPath"] = path + " " + name return cmd } diff --git a/docs/reference/ocm_toi.md b/docs/reference/ocm_toi.md index 4e75a31748..5b21249b43 100644 --- a/docs/reference/ocm_toi.md +++ b/docs/reference/ocm_toi.md @@ -18,13 +18,13 @@ ocm toi [] ... TOI is an abbreviation for (T)iny (O)CM (I)nstallation. It is a simple application framework on top of the Open Component Model, that can be used to describe image based installation executors and installation -packages (see topic [ocm toi bootstrapping](ocm_toi_bootstrapping.md) in form of resources +packages (see topic [ocm toi-bootstrapping](ocm_toi-bootstrapping.md) in form of resources with a dedicated type. All involved resources are hereby taken from a component version of the Open Component Model, which supports all the OCM features, like transportation. The framework consists of a generic bootstrap command -([ocm toi bootstrap componentversions](ocm_toi_bootstrap_componentversions.md)) and an arbitrary set of image +([ocm bootstrap package](ocm_bootstrap_package.md)) and an arbitrary set of image based executors, that are executed in containers and fed with the required installation data by th generic command. @@ -47,11 +47,11 @@ installation data by th generic command. ##### Additional Help Topics -* [ocm toi bootstrapping](ocm_toi_bootstrapping.md) — Tiny OCM Installer based on component versions -* [ocm toi ocm-references](ocm_toi_ocm-references.md) — notation for OCM references +* [ocm toi-bootstrapping](ocm_toi-bootstrapping.md) — Tiny OCM Installer based on component versions +* [ocm ocm-references](ocm_ocm-references.md) — notation for OCM references ##### Additional Links -* [ocm toi bootstrap componentversions](ocm_toi_bootstrap_componentversions.md) +* [ocm bootstrap package](ocm_bootstrap_package.md) — bootstrap component version