Page MenuHomePhabricator

Add an ArgumentParser helper for integers
ClosedPublic

Authored by epriestley on May 3 2022, 9:09 PM.
Tags
None
Referenced Files
F13253023: D21799.diff
Sat, May 25, 2:19 AM
F13244998: D21799.id.diff
Thu, May 23, 5:31 AM
F13244750: D21799.diff
Thu, May 23, 5:17 AM
F13231298: D21799.diff
Tue, May 21, 12:21 AM
F13226855: D21799.diff
Sun, May 19, 11:43 PM
F13220103: D21799.id.diff
Sat, May 18, 11:16 PM
F13198275: D21799.diff
Mon, May 13, 5:33 AM
F13185457: D21799.diff
Sat, May 11, 2:55 AM
Subscribers
None

Details

Summary

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

Repository
rARC Arcanist
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

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