Skip to content

Conversation

hhromic
Copy link
Contributor

@hhromic hhromic commented Jul 15, 2023

Hi @alexflint , this is a small follow-up to PR #223 :)

I realized that I forgot to update the write usage function, and it was still printing the output of Version() even if a custom --version flag spec is present in the arguments. This is now also fixed and I added more unit tests for help/usage writing.

I also took the opportunity to improve a bit the way version flag specs are scanned for both usage and help writing.

I belive that this PR now fully addresses issue #171 because, when using a custom --version flag, the builtin version string (if any) is not printed anymore in usage and errors.

Fixes #171

@codecov-commenter
Copy link

codecov-commenter commented Jul 15, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 99.73%. Comparing base (dfca71d) to head (851ff4c).
Report is 2 commits behind head on master.

Current head 851ff4c differs from pull request most recent head c087d71

Please upload reports for the commit c087d71 to get more accurate results.

Additional details and impacted files
@@           Coverage Diff           @@
##           master     #224   +/-   ##
=======================================
  Coverage   99.72%   99.73%           
=======================================
  Files           5        5           
  Lines         727      744   +17     
=======================================
+ Hits          725      742   +17     
  Misses          1        1           
  Partials        1        1           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@hhromic hhromic changed the title Better version v2 Follow up to improving the handling of version flag Jul 15, 2023
@hhromic hhromic changed the title Follow up to improving the handling of version flag Fix usage writing when using custom version flag Jul 15, 2023
@hhromic
Copy link
Contributor Author

hhromic commented Jan 18, 2024

Rebased on top of the latest master branch.
@alexflint any chance of taking a look a this PR? :)
Thanks!

@alexflint
Copy link
Owner

@hhromic This looks good but I need to look closer because there are quite a few changes (even ignoring the tests -- thanks for adding those)

@hhromic
Copy link
Contributor Author

hhromic commented Jun 29, 2024

Hi @alexflint !
I rebased this PR on top of the current master branch in case you are still interested on this fix.
I also refactored the unit tests to be closer to the coding style you had already.

EDIT: With this PR, the test suite covers 100.0% of the code (in contrast to 99.8% in current master):

PASS
coverage: 100.0% of statements
ok      github.com/alexflint/go-arg     0.025s

@alexflint
Copy link
Owner

Wonderful, thanks for doing this @hhromic

@alexflint alexflint merged commit 0cc152d into alexflint:master Jun 30, 2024
@hhromic hhromic deleted the better-version-v2 branch June 30, 2024 19:35
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.

Overriding --version

3 participants