Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove code duplication in Command.Run functions. #1072

Open
elhimov opened this issue Dec 24, 2024 · 0 comments
Open

Remove code duplication in Command.Run functions. #1072

elhimov opened this issue Dec 24, 2024 · 0 comments
Labels
code health Improve code readability, simplify maintenance and so on

Comments

@elhimov
Copy link
Contributor

elhimov commented Dec 24, 2024

The vast range of tt commands have almost indentical Run functions. The only variable part is internal module function (marked with uppercase in below code)

Run: func(cmd *cobra.Command, args []string) {
	cmdCtx.CommandName = cmd.Name()
	err := modules.RunCmd(&cmdCtx, cmd.CommandPath(), &modulesInfo,
		INTERNAL_DOWNLOAD_MODULE, args)
	util.HandleCmdErr(cmd, err)
},
@elhimov elhimov added the code health Improve code readability, simplify maintenance and so on label Dec 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code health Improve code readability, simplify maintenance and so on
Projects
None yet
Development

No branches or pull requests

1 participant