Commit Graph

7 Commits

Author SHA1 Message Date
Daniele Sluijters 08e5e4d956 Support different integer formats
In Go you can format numbers in different ways, as doucment in
https://go.dev/ref/spec#Integer_literals.

ParseInt with a base of 0 will infer the correct base for the number
based on a prefix 0x, 0b etc, and also supports the use of the _
to separate digits. This can be helpful with long numbers, to make
things easier to read.

This switches the ParseInt() calls to use a base of 0, ensuring that if
ParseValue is called with an int like 100_000 it'll parse correctly
instead of throw an error.
2022-10-02 19:11:37 +02:00
Alex Flint 8ca9e7daec improve test coverage 2021-08-20 20:18:30 -07:00
Alex Flint 9e23a0e262 add support for url.URL 2021-08-17 12:24:43 -07:00
Pavel Borzenkov 38f8eb7c6b Allow to use values (not pointers) with TextUnmarshaler
The patch makes sure that both values and pointer to values are checked
for custom TextUnmarshal implementation. This will allow to use go-arg
custom parsing as follows:

var args struct {
  Arg CustomType
}

instead of

var args struct {
  Arg *CustomType
}

Signed-off-by: Pavel Borzenkov <pavel.borzenkov@gmail.com>
2018-11-16 17:09:52 +03:00
Alex Flint 9cd235e2a7 fix tests 2017-02-15 17:56:45 -08:00
Alex Flint be3c7a3252 add misc support files 2017-02-15 17:52:23 -08:00
Alex Flint 679dadd066 based functions all working 2017-02-15 17:42:57 -08:00