diff --git a/internal/commands/iam/serviceprincipals/sps.go b/internal/commands/iam/serviceprincipals/sps.go index 903f0281..90916b0b 100644 --- a/internal/commands/iam/serviceprincipals/sps.go +++ b/internal/commands/iam/serviceprincipals/sps.go @@ -19,7 +19,8 @@ func NewCmdServicePrincipals(ctx *cmd.Context) *cmd.Command { interacts with HCP. Your application uses the service principal to authenticate to HCP so that users aren't directly involved. - Because service principals are principals, you can grant it permissions by granting a role. Refer to the examples for guidance. + Because service principals are principals, you can grant it permissions + by granting a role. Refer to the examples for guidance. `), Examples: []cmd.Example{ { diff --git a/internal/commands/organizations/iam/add_binding.go b/internal/commands/organizations/iam/add_binding.go index f248068b..e0303880 100644 --- a/internal/commands/organizations/iam/add_binding.go +++ b/internal/commands/organizations/iam/add_binding.go @@ -26,8 +26,9 @@ func NewCmdAddBinding(ctx *cmd.Context, runF func(*AddBindingOpts) error) *cmd.C Name: "add-binding", ShortHelp: "Add an IAM policy binding for the organization.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp organizations iam add-binding" }} command adds an IAM policy binding for the organization. A binding grants the - specified principal the given role on the organization. + The {{ template "mdCodeOrBold" "hcp organizations iam add-binding" }} + command adds an IAM policy binding for the organization. A binding + grants the specified principal the given role on the organization. To view the available roles to bind, run {{ template "mdCodeOrBold" "hcp iam roles list" }}. diff --git a/internal/commands/organizations/iam/delete_binding.go b/internal/commands/organizations/iam/delete_binding.go index 4db6f82a..5bdc1746 100644 --- a/internal/commands/organizations/iam/delete_binding.go +++ b/internal/commands/organizations/iam/delete_binding.go @@ -23,8 +23,9 @@ func NewCmdDeleteBinding(ctx *cmd.Context, runF func(*DeleteBindingOpts) error) Name: "delete-binding", ShortHelp: "Delete an IAM policy binding for the organization.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp organizations iam delete-binding" }} command deletes an IAM policy binding for the organization. A binding consists of a - principal and a role. + The {{ template "mdCodeOrBold" "hcp organizations iam delete-binding" }} + command deletes an IAM policy binding for the organization. A binding + consists of a principal and a role. To view the existing role bindings, run {{ template "mdCodeOrBold" "hcp organizations iam read-policy" }}. `), diff --git a/internal/commands/organizations/iam/set_policy.go b/internal/commands/organizations/iam/set_policy.go index 01a5ae8b..45c61da8 100644 --- a/internal/commands/organizations/iam/set_policy.go +++ b/internal/commands/organizations/iam/set_policy.go @@ -30,7 +30,8 @@ func NewCmdSetPolicy(ctx *cmd.Context, runF func(*SetPolicyOpts) error) *cmd.Com Name: "set-policy", ShortHelp: "Set the IAM policy for the organization.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp organizations iam set-policy" }} command sets the IAM policy for the organization. Setting the entire policy must be done +The {{ template "mdCodeOrBold" "hcp organizations iam set-policy" }} command sets +the IAM policy for the organization. Setting the entire policy must be done with great care. If adding or removing a single principal from the policy, prefer using {{ template "mdCodeOrBold" "hcp organizations iam add-binding" }} and the related {{ template "mdCodeOrBold" "hcp organizations iam delete-binding" }}. diff --git a/internal/commands/organizations/list.go b/internal/commands/organizations/list.go index 545041dc..df78c5a2 100644 --- a/internal/commands/organizations/list.go +++ b/internal/commands/organizations/list.go @@ -26,7 +26,8 @@ func NewCmdList(ctx *cmd.Context, runF func(*ListOpts) error) *cmd.Command { Name: "list", ShortHelp: "List organizations.", LongHelp: heredoc.New(ctx.IO).Must(` - "The {{ template "mdCodeOrBold" "hcp organizations list" }} command lists the organizations the authenticated principal is a member of." + "The {{ template "mdCodeOrBold" "hcp organizations list" }} command + lists the organizations the authenticated principal is a member of." `), RunF: func(c *cmd.Command, args []string) error { if runF != nil { diff --git a/internal/commands/profile/init.go b/internal/commands/profile/init.go index 1f62599f..31e2627b 100644 --- a/internal/commands/profile/init.go +++ b/internal/commands/profile/init.go @@ -32,9 +32,10 @@ func NewCmdInit(ctx *cmd.Context) *cmd.Command { Name: "init", ShortHelp: "Initialize the current profile.", LongHelp: heredoc.New(ctx.IO).Mustf(` - The {{ template "mdCodeOrBold" "hcp profile init" }} command configures the HCP CLI to run commands against the correct context; namely against the - desired organization and project ID. This command is interactive. To set configuration using - non-interactively prefer using {{ template "mdCodeOrBold" "hcp profile set" }}. + The {{ template "mdCodeOrBold" "hcp profile init" }} command configures + the HCP CLI to run commands against the correct context; namely against + the desired organization and project ID. This command is interactive. To + set configuration using non-interactively prefer using {{ template "mdCodeOrBold" "hcp profile set" }}. For a list of all available options, run {{ template "mdCodeOrBold" "hcp config --help" }}. `), diff --git a/internal/commands/profile/profiles/delete.go b/internal/commands/profile/profiles/delete.go index 499025d2..4fa4e6d6 100644 --- a/internal/commands/profile/profiles/delete.go +++ b/internal/commands/profile/profiles/delete.go @@ -17,7 +17,9 @@ func NewCmdDelete(ctx *cmd.Context) *cmd.Command { Name: "delete", ShortHelp: "Delete an existing HCP profile.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp profile profiles delete" }} command deletes an existing HCP profiles. If the profile is the active profile, it may not be deleted. + The {{ template "mdCodeOrBold" "hcp profile profiles delete" }} command + deletes an existing HCP profiles. If the profile is the active profile, + it may not be deleted. To delete the current active profile, first run {{ template "mdCodeOrBold" "hcp profile profiles activate" }} to active a different profile. diff --git a/internal/commands/projects/create.go b/internal/commands/projects/create.go index 7b071270..687ad723 100644 --- a/internal/commands/projects/create.go +++ b/internal/commands/projects/create.go @@ -35,7 +35,8 @@ func NewCmdCreate(ctx *cmd.Context, runF func(*CreateOpts) error) *cmd.Command { Name: "create", ShortHelp: "Create a new project.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp products create" }} command creates a new project with the given name. The currently authenticated principal + The {{ template "mdCodeOrBold" "hcp products create" }} command creates + a new project with the given name. The currently authenticated principal will be given role "admin" on the newly created project. `), Examples: []cmd.Example{ diff --git a/internal/commands/projects/delete.go b/internal/commands/projects/delete.go index 65a29d75..2e741e18 100644 --- a/internal/commands/projects/delete.go +++ b/internal/commands/projects/delete.go @@ -25,7 +25,9 @@ func NewCmdDelete(ctx *cmd.Context, runF func(*DeleteOpts) error) *cmd.Command { Name: "delete", ShortHelp: "Delete a project.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp products delete" }} command deletes the specified project. The project must be empty before it can be deleted. + The {{ template "mdCodeOrBold" "hcp products delete" }} command deletes + the specified project. The project must be empty before it can be + deleted. `), Examples: []cmd.Example{ { diff --git a/internal/commands/projects/iam/set_policy.go b/internal/commands/projects/iam/set_policy.go index 5ebc9aaa..4e7f182f 100644 --- a/internal/commands/projects/iam/set_policy.go +++ b/internal/commands/projects/iam/set_policy.go @@ -29,8 +29,14 @@ func NewCmdSetPolicy(ctx *cmd.Context, runF func(*SetPolicyOpts) error) *cmd.Com Name: "set-policy", ShortHelp: "Set the IAM policy for a project.", LongHelp: heredoc.New(ctx.IO).Must(` -Sets the IAM policy for a project, given a project ID and a file encoded in -JSON that contains the IAM policy. +The {{ template "mdCodeOrBold" "hcp projects iam set-policy" }} command sets +the IAM policy for the project, given a project ID and a file encoded in +JSON that contains the IAM policy. If adding or removing a single principal from +the policy, prefer using {{ template "mdCodeOrBold" "hcp projects iam add-binding" }} +and the related {{ template "mdCodeOrBold" "hcp projects iam delete-binding" }}. + +The policy file is expected to be a file encoded in JSON that +contains the IAM policy. The format for the policy JSON file is an object with the following format: diff --git a/internal/commands/waypoint/actionconfig/create.go b/internal/commands/waypoint/actionconfig/create.go index 68dfff24..6c87321d 100644 --- a/internal/commands/waypoint/actionconfig/create.go +++ b/internal/commands/waypoint/actionconfig/create.go @@ -38,7 +38,9 @@ func NewCmdCreate(ctx *cmd.Context) *cmd.Command { Name: "create", ShortHelp: "Create a new action configuration.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp waypoint action-config create" }} command creates a new action configuration to be used to launch an action with. + The {{ template "mdCodeOrBold" "hcp waypoint action-config create" }} + command creates a new action configuration to be used to launch an + action with. `), RunF: func(c *cmd.Command, args []string) error { return createActionConfig(c, args, opts) diff --git a/internal/commands/waypoint/actionconfig/delete.go b/internal/commands/waypoint/actionconfig/delete.go index 666f0177..cc8f0eb1 100644 --- a/internal/commands/waypoint/actionconfig/delete.go +++ b/internal/commands/waypoint/actionconfig/delete.go @@ -25,7 +25,9 @@ func NewCmdDelete(ctx *cmd.Context) *cmd.Command { Name: "delete", ShortHelp: "Delete an existing action configuration.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp waypoint action-config delete" }} command deletes an existing action configuration. This will remove the config completely from HCP Waypoint. + The {{ template "mdCodeOrBold" "hcp waypoint action-config delete" }} + command deletes an existing action configuration. This will remove the + config completely from HCP Waypoint. `), RunF: func(c *cmd.Command, args []string) error { return deleteActionConfig(c, args, opts) diff --git a/internal/commands/waypoint/actionconfig/list.go b/internal/commands/waypoint/actionconfig/list.go index 0a2c2a0b..8a2c7b92 100644 --- a/internal/commands/waypoint/actionconfig/list.go +++ b/internal/commands/waypoint/actionconfig/list.go @@ -23,7 +23,8 @@ func NewCmdList(ctx *cmd.Context) *cmd.Command { Name: "list", ShortHelp: "List all known action configurations.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp waypoint action-config list" }} command lists all known action configurations from HCP Waypoint. + The {{ template "mdCodeOrBold" "hcp waypoint action-config list" }} + command lists all known action configurations from HCP Waypoint. `), RunF: func(c *cmd.Command, args []string) error { return listActionConfig(c, args, opts) diff --git a/internal/commands/waypoint/actionconfig/read.go b/internal/commands/waypoint/actionconfig/read.go index 7d8ae6ad..805c2208 100644 --- a/internal/commands/waypoint/actionconfig/read.go +++ b/internal/commands/waypoint/actionconfig/read.go @@ -26,7 +26,8 @@ func NewCmdRead(ctx *cmd.Context) *cmd.Command { Name: "read", ShortHelp: "Read more details about an action configurations.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp waypoint action-config read" }} command returns more details about an action configurations. + The {{ template "mdCodeOrBold" "hcp waypoint action-config read" }} + command returns more details about an action configurations. `), RunF: func(c *cmd.Command, args []string) error { return readActionConfig(c, args, opts) diff --git a/internal/commands/waypoint/actionconfig/update.go b/internal/commands/waypoint/actionconfig/update.go index 99d963c3..b7abe587 100644 --- a/internal/commands/waypoint/actionconfig/update.go +++ b/internal/commands/waypoint/actionconfig/update.go @@ -39,7 +39,9 @@ func NewCmdUpdate(ctx *cmd.Context) *cmd.Command { Name: "update", ShortHelp: "Update a action configuration.", LongHelp: heredoc.New(ctx.IO).Must(` - The {{ template "mdCodeOrBold" "hcp waypoint action-config update" }} command updates a action configuration to be used to launch an action with. + The {{ template "mdCodeOrBold" "hcp waypoint action-config update" }} + command updates a action configuration to be used to launch an action + with. `), RunF: func(c *cmd.Command, args []string) error { return updateActionConfig(c, args, opts) diff --git a/internal/pkg/heredoc/heredoc.go b/internal/pkg/heredoc/heredoc.go index 8b7a00a6..ac00640d 100644 --- a/internal/pkg/heredoc/heredoc.go +++ b/internal/pkg/heredoc/heredoc.go @@ -133,7 +133,7 @@ func (f *Formatter) Docf(tmpl string, args ...any) (string, error) { // - mdCodeOrBold: If the output is markdown, it will return the string in a // code stanza. Otherwise, it will return the string in bold. // An example usage is: -// {{ template "mdCodeOrBold" "hcp projects iam read-policy --format=json" }} +// {{ template "mdCodeOrBold" "hcp projects iam read-policy --format=json" }} // // After rendering the template following manipulations are made: // - The text is dedented. This allows you to use a Go string literal and not