Page MenuHomePhabricator

Add an ArgumentParser helper for integers
ClosedPublic

Authored by epriestley on May 3 2022, 9:09 PM.
Tags
None
Referenced Files
F18802702: D21799.id.diff
Fri, Oct 17, 8:01 PM
F18791615: D21799.diff
Thu, Oct 16, 4:12 PM
F18671020: D21799.id51963.diff
Sep 25 2025, 2:27 AM
F18670268: D21799.diff
Sep 24 2025, 11:36 PM
F18654373: D21799.diff
Sep 22 2025, 7:10 AM
F18654364: D21799.diff
Sep 22 2025, 7:07 AM
F18654359: D21799.diff
Sep 22 2025, 7:04 AM
F18651494: D21799.id51958.diff
Sep 21 2025, 4:30 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.