Register flag

This commit is contained in:
lash 2022-05-11 15:41:18 +00:00
parent 14460ed76e
commit 88cf5500bf
Signed by: lash
GPG Key ID: 21D2E7BB88C2A746
1 changed files with 47 additions and 11 deletions

View File

@ -196,7 +196,7 @@ class ArgumentParser(argparse.ArgumentParser):
# self.add_argument('-w', action='store_true', help='Wait for the last transaction to be confirmed')
# self.add_argument('-ww', action='store_true', help='Wait for every transaction to be confirmed')
# if arg_flags & Flag.ENV_PREFIX:
# self.add_argument('--env-prefix', default=env.get('CONFINI_ENV_PREFIX'), dest='env_prefix', type=str, help='environment prefix for variables to overwrite configuration')
# self.add_argument('--env-prefix', default=env.get('CONFINI_ENV_PREFIX'), dest='env', type=str, help='environment prefix for variables to overwrite configuration')
# if arg_flags & Flag.PROVIDER:
# self.add_argument('-p', '--rpc-provider', dest='p', type=str, help='RPC HTTP(S) provider url')
# self.add_argument('--rpc-dialect', dest='rpc_dialect', type=str, help='RPC HTTP(S) backend dialect')
@ -248,7 +248,7 @@ class ArgFlag(BaseArgFlag):
self.add('verbose')
self.add('config')
self.add('raw')
self.add('env_prefix')
self.add('env')
self.add('provider')
self.add('chain_spec')
self.add('unsafe')
@ -269,8 +269,8 @@ class ArgFlag(BaseArgFlag):
self.add('fmt_rpc')
self.add('veryverbose')
self.alias('std_base', 'verbose', 'config', 'raw', 'env_prefix', 'no_target')
self.alias('std_base_read', 'verbose', 'config', 'raw', 'env_prefix', 'provider', 'chain_spec', 'seq')
self.alias('std_base', 'verbose', 'config', 'raw', 'env', 'no_target')
self.alias('std_base_read', 'verbose', 'config', 'raw', 'env', 'provider', 'chain_spec', 'seq')
self.alias('std_read', 'std_base', 'provider', 'chain_spec', 'unsafe', 'seq', 'key_file', 'fee', 'no_target')
self.alias('std_write', 'provider', 'chain_spec', 'unsafe', 'seq', 'key_file', 'sign', 'no_target', 'wait', 'wait_all', 'send', 'rpc_auth')
self.alias('std_target', 'no_target', 'exec', 'wallet')
@ -281,13 +281,49 @@ class Arg(BaseArg):
def __init__(self, flags):
super(Arg, self).__init__(flags)
self.add_long('no-logs', 'verbose', typ=bool)
self.add('v', 'verbose', typ=bool)
self.add('vv', 'verbose', check=False, typ=bool)
self.add('vvv', 'veryverbose', check=False, typ=bool)
self.add_long('no-logs', 'verbose', typ=bool, help='Turn off all logging')
self.add('v', 'verbose', typ=bool, help='Be verbose')
self.add('vv', 'verbose', check=False, typ=bool, help='Be more verbose')
self.add('vvv', 'veryverbose', check=False, typ=bool, help='Be morse verbose with custom tracing')
self.add('n', 'config')
self.add('n', 'config', help='Configuration namespace')
self.set_long('n', 'namespace', dest='namespace')
self.add('c', 'config', dest='config')
self.add('c', 'config', dest='config', help='Configuration directory')
self.set_long('c', 'config')
self.add_long('dumpconfig', 'config', typ=bool)
self.add_long('dumpconfig', 'config', typ=bool, help='Output configuration and quit. Use with --raw to omit values and output schema only.')
self.add('w', 'wait', typ=bool, help='Wait for the last transaction to be confirmed')
self.add('ww', 'wait', check=False, typ=bool, help='Wait for every transaction to be confirmed')
self.add_long('env-prefix', 'env', help='environment prefix for variables to overwrite configuration')
self.add('p', 'provider', help='RPC HTTP(S) provider url')
self.set_long('p', 'provider')
self.add_long('rpc-dialect', 'provider', help='RPC HTTP(S) backend dialect')
self.add_long('height', 'no_target', default='latest', help='Block height to execute against')
self.add_long('rpc-auth', 'rpc_auth', help='RPC autentication scheme')
self.add_long('rpc-credentials', 'rpc_auth', help='RPC autentication credential values')
self.add('i', 'chain_spec', help='Chain specification string')
self.set_long('i', 'chain-spec')
self.add('u', 'unsafe', help='Do not verify address checksums')
self.set_long('u', 'unsafe')
self.add_long('seq', 'seq', typ=bool, help='Use sequential rpc ids')
self.add('y', 'key_file', help='Keystore file to use for signing or address')
self.set_long('y', 'key-file')
self.add_long('passphrase-file', 'key_file', help='Keystore file to use for signing or address')
self.add('s', 'send', typ=bool, help='Send to network')
self.set_long('s', 'send')
self.add_long('raw', 'raw', typ=bool, help='Do not decode output')
self.add('0', 'raw', typ=bool, help='Omit newline to output')
self.add_long('nonce', 'nonce', typ=int, help='override nonce')
self.add_long('fee-price', 'fee', typ=int, help='override fee price')
self.add_long('fee-limit', 'fee', typ=int, help='override fee limit')