OCamlPro / freeton_wallet

The 'ft' tool is a multi-account terminal wallet for the Free TON blockchain. It is based on the freeton_ocaml_sdk.
https://ocamlpro.github.io/freeton_wallet
Other
14 stars 9 forks source link

Masterchain addresses wrongly parsed as a command line option #4

Closed lefessan closed 3 years ago

lefessan commented 3 years ago

The following example does not work:

$ ft account --create myuser2 --address "-1:a3dbe7dbda246199d7af8a361b01eb1313cfa2932029b29133f980b7b51d1bcd" --contract SafeMultisigWallet

ft: unknown option -1'.
Usage: ft account [OPTION]... [ARG]...
Try ft account --help' or `ft --help' for more information.
lefessan commented 3 years ago

The temporary solution is to use --address=-1:a3dbe7dbda246199d7af8a361b01eb1313cfa2932029b29133f980b7b51d1bcd for example. I am not sure if the issue can easily be fixed, it looks like a problem of Cmdliner, the library used to parse command line options.

ddeclerck commented 3 years ago

Another solution could be to add a single-dash option for address, to avoid the extra '=' (but you'd still have to glue the option name with the argument).

lefessan commented 3 years ago

Fixed.

The current solution is to preprocess all options and add a 0 in front of -1:, so that -1:XXX becomes 0-1:XXX. This notation is later recognized as the same as -1:XXX.