Page MenuHomePhabricator

Add an ArgumentParser helper for integers

Authored by epriestley on Tue, May 3, 9:09 PM.



Ref T13676. With increased PHP8.1 strictness around null, it seems reasonable to add some convenience parsing to "PhutilArgumentParser".

Add a helper function for parsing integers.

Test Plan

See next change. Tried these arguments:

--count ''
--count asdf
--count 0
--count -3
--count 999999999999999999999999999999999999999999999234
--count 5

Got sensible parsing and appropriate feedback in all cases.

Diff Detail

rARC Arcanist
Lint Not Applicable
Tests Not Applicable

Event Timeline

epriestley created this revision.
This revision was not accepted when it landed; it landed in state Needs Review.Tue, May 3, 10:57 PM
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.