SIGN IN SIGN UP
spf13 / cobra UNCLAIMED

A Commander for modern Go CLI interactions

0 0 139 Go

Micro-optimizations (#1957)

* Avoid redundant string splits

There likely isn't actually more than once to split in the source
strings in these cases, but avoid doing so anyway as we're only
interested in the first.

* Avoid redundant completion output target evaluations

The target is not to be changed while outputting completions, so resolve
it only once.

* Avoid redundant active help enablement evaluations

The enablement state is not to be changed during completion output, so
evaluate it only once.

* Preallocate some slices and maps with known size

* Avoid some unnecessary looping

* Use strings.Builder to construct suggestions
V
Ville Skyttä committed
3d8ac432bdad89db04ab0890754b2444d7b4e1cf
Parent: 283e32d
Committed by GitHub <noreply@github.com> on 11/23/2023, 5:24:33 PM