Skip to content

cmd: replace args with specific argument(s) in helper functions #1075

@elhimov

Description

@elhimov

Argument args looks natural in command handler functions where its meaning is quite clear. A few examples:

func internalConnectModule(cmdCtx *cmdcontext.CmdCtx, args []string) error
func internalRestartModule(cmdCtx *cmdcontext.CmdCtx, args []string) error

But being used in helper functions, like

func replicasetFillCtx(cmdCtx *cmdcontext.CmdCtx, ctx *replicasetCtx, args []string,
	isRunningCtxRequired bool) error
func resolveConnectOpts(cmdCtx *cmdcontext.CmdCtx, cliOpts *config.CliOpts,
	connectCtx *connect.ConnectCtx, args []string) ...

it turns into a problem, because this kind of functions expect some specific argument(s), not the abstract list of arguments. It makes the code less readable and harder to maintain.

Metadata

Metadata

Assignees

Labels

code healthImprove code readability, simplify maintenance and so onteamE

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions