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

Update cmd.go #11

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Update cmd.go #11

wants to merge 1 commit into from

Conversation

mdqst
Copy link

@mdqst mdqst commented Oct 30, 2024

I optimized the code to make it run faster.

Here's what I did:

  1. Simplify command creation by extracting repetitive logic into separate functions.
  2. Consolidate some lines for compactness.
  3. Improve readability and maintainability of the structure.

Key Changes:

  • main() function: Added to execute CreateRootCommand with error handling.
  • createSafeCommand(): Used to create the singleton, singleton-l2, proxy, and factory commands, making the code compact and easier to extend.
  • addSubCommands(): Builds subcommands for completion using a struct list to reduce repetition.
  • Condensed description in the completion command’s Long field.

Code optimization. Now the code works faster and more accurately.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant