Commit graph

12 commits

Author SHA1 Message Date
Ville Skyttä 3d8ac432bd
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
2023-11-23 12:24:33 -05:00
Unai Martinez-Corral 9e6b58afc7
update copyright year (#1927) 2023-03-05 21:28:31 -05:00
Yash Ladha bf11ab6321
fix: func name in doc strings (#1885)
Corrected the function name at the start of doc strings, as per the convention
outlined in official go documentation: https://go.dev/blog/godoc
2022-12-25 15:08:39 -05:00
Unai Martinez-Corral 6d978a911e
add missing license headers (#1809) 2022-09-16 07:55:56 -04:00
Unai Martinez-Corral 70e53f62be
Deprecate ExactValidArgs() and test combinations of args validators (#1643)
* deprecate ExactValidArgs in favour of MatchAll(OnlyValidArgs, ...)
* test combinations of args validators
* adjust docs
2022-09-10 09:33:34 -04:00
Nelz 45e521ea93
enable composing PositionalArgs (#896)
* enable composing PositionalArgs
* ExactValidArgs slated for removal
* tests and docs
* rename to MatchAll
2021-12-07 15:38:00 -07:00
Marc Khouzam a684a6d7f5
Fish completion using Go completion (#1048)
Signed-off-by: Marc Khouzam <marc.khouzam@montreal.ca>
2020-04-10 13:56:28 -06:00
Bruce Downs 993cc5372a Adjustments per PR review feedback from @bogem 2019-08-02 01:25:21 +05:00
Bruce Downs 51f06c7dd1 Correct all complaints from golint
* i.e.
* go get golang.org/x/lint/golint
* go list ./... | xargs golint
2019-08-02 01:25:21 +05:00
bpdunni f619abc1d7 Added ExactValidArgs (#765) 2018-10-21 10:01:21 -04:00
Albert Nigmatzianov 099c5aef9e Add dots in comments of args.go 2017-11-09 07:56:43 +01:00
Daniel Nephin f20b4e9c32 Refactor TakesArgs to use an interface for arg validation.
Fix some typos in README and comments.
Move arg validation to after flag validation so that the help flag is run first.
Pass the same args to ValidateArgs as the Run methods receive.
Update README.

Signed-off-by: Daniel Nephin <dnephin@gmail.com>
2017-07-23 09:57:27 +02:00