Hi,
I am writing a program using cobra and pflag.
There is one option as below:
cmd.Flags().UintSliceVarP(&data, "data", "u", []uint{}, "write data separated by ,")
I expect it can accept integer data list no matter decimal or hexadecimal format.
But below error reported when using hex data.
There is no such kind of problem when using Int32SliceVarP or Int64SliceVarP.
By the way, actually I need Uint32SliceVarP, but seems it is not supported yet.
fexp haps write_umrbus -u 0x86
Error: invalid argument "0x86" for "-u, --data" flag: strconv.ParseUint: parsing "0x86": invalid syntax
Usage:
fexp haps write_umrbus [flags]
Flags:
-b, --bus uint32 umrbus bus number (default 1)
-u, --data uints write data seperated by , (default [])
-d, --device uint32 umrbus device number (default 8)
-h, --help help for write_umrbus
-i, --id uint32 umrbus capim address (default 1)
Global Flags:
-s, --host string server host name (default "localhost")
-p, --port uint32 server port number (default 60066)
-v, --verbose show verbose information
invalid argument "0x86" for "-u, --data" flag: strconv.ParseUint: parsing "0x86": invalid syntax
Guofu
Hi,
I am writing a program using cobra and pflag.
There is one option as below:
cmd.Flags().UintSliceVarP(&data, "data", "u", []uint{}, "write data separated by ,")
I expect it can accept integer data list no matter decimal or hexadecimal format.
But below error reported when using hex data.
There is no such kind of problem when using Int32SliceVarP or Int64SliceVarP.
By the way, actually I need Uint32SliceVarP, but seems it is not supported yet.
fexp haps write_umrbus -u 0x86
Error: invalid argument "0x86" for "-u, --data" flag: strconv.ParseUint: parsing "0x86": invalid syntax
Usage:
fexp haps write_umrbus [flags]
Flags:
-b, --bus uint32 umrbus bus number (default 1)
-u, --data uints write data seperated by , (default [])
-d, --device uint32 umrbus device number (default 8)
-h, --help help for write_umrbus
-i, --id uint32 umrbus capim address (default 1)
Global Flags:
-s, --host string server host name (default "localhost")
-p, --port uint32 server port number (default 60066)
-v, --verbose show verbose information
invalid argument "0x86" for "-u, --data" flag: strconv.ParseUint: parsing "0x86": invalid syntax
Guofu