Commit graph

9 commits

Author SHA1 Message Date
f8a312e407
coin-specific and protocol-specific configuration options
Rationale: to enable communication with multiple coin daemons on multiple hosts
in a single program invocation, making possible the implementation of asset
swap functionality, for instance

Coin-specific options are prefixed with a coin symbol, proto-specific options
with a coin symbol plus a network name.

Coin- and protocol-specific options override their non-prefixed counterparts.
They are available via the command line, configuration file and Config API.

Currently available options:

    Option                   Supported Prefixes
    tw_name                  btc ltc bch
    rpc_user                 btc ltc bch
    rpc_password             btc ltc bch
    rpc_host                 btc ltc bch eth etc
    rpc_port                 btc ltc bch eth etc xmr
    ignore_daemon_version    btc ltc bch eth etc xmr
    max_tx_fee               btc ltc bch eth etc
    chain_names              eth_mainnet eth_testnet etc_mainnet etc_testnet

Example:

    $ mmgen-tool --coin=ltc --ltc-tw-name=ltc2 --ltc-ignore-daemon-version twview

Help:

    $ mmgen-tool --longhelp
    $ view mmgen/data/mmgen.cfg

Testing:

    $ test/daemontest.py rpc.btc rpc.geth
    $ test/cmdtest.py help opts cfgfile
2025-01-27 16:01:53 +00:00
46381def86
cmdtest.py opts: cleanups 2025-01-27 16:01:53 +00:00
7131b892e3
minor fixes and cleanups 2025-01-27 16:01:48 +00:00
df3559d420
support negated command-line options
- all options without parameters may be negated by prefixing the option name
  with ‘no-’
- if the option name itself begins with ‘no-’, then the option is negated
  by removing the ‘no-’ prefix
- negation may be used to override options set in the cfg file
- command-line options may also be overridden, with the last-listed option
  taking precedence
- as with ordinary options, substring matching is supported

Examples:

    OPTION        NEGATED OPTION
    --no-license  --license
    --no-license  --lic
    --quiet       --no-quiet
    --quiet       --no-q

Testing:

    $ test/cmdtest.py opts cfgfile
2024-10-20 10:19:02 +00:00
f9e6d994f0
whitespace: test/misc 2024-10-18 10:32:13 +00:00
6e728b7f4d
opts: allow combined short option with parameter; add tests
`foo -abparam`, equivalent to `foo -a -bparam`, is now allowed, in conformity
with standard Unix option parsing convention.
2024-10-10 11:28:51 +00:00
d7e3b55e3b
opts, help: refactor, parse cmdline opts natively, filter global opts
- command-line options are now parsed natively, without use of the getopt module
- global options and --longhelp helpscreen are now contextual, depending on coin
  and executed command
- commands invoked with out-of-context global options (e.g. `mmgen-walletgen
  --coin=btc`) now fail with an ‘unrecognized option’ error

Testing:

    $ test/test-release.sh help
    $ test/cmdtest.py opts
2024-10-08 12:56:02 +00:00
66521a07f2
update --longhelp text 2024-10-08 12:55:58 +00:00
211b71431d
renamed: test/misc/opts.py -> test/misc/opts_main.py 2024-03-08 14:13:23 +00:00
Renamed from test/misc/opts.py (Browse further)