Skip to content

Commit 52147f0

Browse files
committed
refactor: convert CLI methods to use pointer receivers
Updated all CLI method receivers to use pointer semantics (*CLI) instead of value (CLI), ensuring consistent behavior across command setup functions and reducing potential for unintentional value copying.
1 parent c01aac2 commit 52147f0

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

pkg/cli/cli.go

+8-1
Original file line numberDiff line numberDiff line change
@@ -472,6 +472,13 @@ func (c *CLI) Run() error {
472472
}
473473

474474
// Command returns the underlying root command.
475-
func (c *CLI) Command() *cobra.Command {
475+
//
476+
// Deprecated: Use (c *CLI).CommandPtr() instead.
477+
func (c CLI) Command() *cobra.Command {
478+
return (&c).CommandPtr()
479+
}
480+
481+
// CommandPtr returns the underlying root command.
482+
func (c *CLI) CommandPtr() *cobra.Command {
476483
return c.cmd
477484
}

0 commit comments

Comments
 (0)