Page MenuHomePhabricator

Add an ArgumentParser helper for integers
ClosedPublic

Authored by epriestley on May 3 2022, 9:09 PM.
Tags
None
Referenced Files
F13333970: D21799.id51958.diff
Tue, Jun 18, 2:24 PM
F13333675: D21799.diff
Tue, Jun 18, 9:12 AM
F13329582: D21799.diff
Mon, Jun 17, 12:54 AM
F13326845: D21799.diff
Sat, Jun 15, 9:20 AM
F13317295: D21799.diff
Thu, Jun 13, 9:16 AM
F13303025: D21799.diff
Sat, Jun 8, 6:13 AM
F13292854: D21799.diff
Wed, Jun 5, 5:17 AM
F13278808: D21799.id51963.diff
Sat, Jun 1, 5:06 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.