From 7e6daa0be329485b75a5f44f66a5c3472e327886 Mon Sep 17 00:00:00 2001 From: lash Date: Thu, 24 Feb 2022 10:36:15 +0000 Subject: [PATCH] Add get man page, remove chain spec arg from get, info --- CHANGELOG | 3 ++- Makefile | 5 +++-- chainlib/eth/cli/arg.py | 3 ++- chainlib/eth/runnable/flags.py | 2 ++ chainlib/eth/runnable/get.py | 3 ++- man/get.head.groff | 17 +++++++++++++++++ man/info.head.groff | 27 +++++++++++++++++++++++++++ 7 files changed, 55 insertions(+), 5 deletions(-) create mode 100644 man/get.head.groff create mode 100644 man/info.head.groff diff --git a/CHANGELOG b/CHANGELOG index 2fd23d2..5c98561 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,5 +1,6 @@ - 0.0.27: - * Add man pages + * Add man pages with chainlib man page generator helper + * Remove redundant arg flags from runnables: get - 0.0.26: * Remove manual 0x handling bug in tx - 0.0.25: diff --git a/Makefile b/Makefile index d1bc761..76ccaec 100644 --- a/Makefile +++ b/Makefile @@ -3,8 +3,9 @@ BUILD_DIR = build/$(PREFIX)/share/man man: mkdir -vp $(BUILD_DIR) - chainlib-man.py -b`PYTHONPATH=. python chainlib/eth/runnable/flags.py gas` -n eth-gas -d $(BUILD_DIR)/ man/gas.head.groff - chainlib-man.py -b`PYTHONPATH=. python chainlib/eth/runnable/flags.py info` -n eth-info -d $(BUILD_DIR)/ man/info.head.groff + chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py gas` -v -n eth-gas -d $(BUILD_DIR)/ man/gas.head.groff + chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py info` -v -n eth-info -d $(BUILD_DIR)/ man/info.head.groff + chainlib-man.py -b `PYTHONPATH=. python chainlib/eth/runnable/flags.py get` -v -n eth-get -d $(BUILD_DIR)/ man/get.head.groff .PHONY: man diff --git a/chainlib/eth/cli/arg.py b/chainlib/eth/cli/arg.py index 99a4b9e..4b73a17 100644 --- a/chainlib/eth/cli/arg.py +++ b/chainlib/eth/cli/arg.py @@ -4,6 +4,7 @@ from chainlib.cli import ( argflag_std_read, argflag_std_write, argflag_std_base, - reset as argflag_reset, + argflag_std_base_read, + flag_reset as argflag_reset, Flag, ) diff --git a/chainlib/eth/runnable/flags.py b/chainlib/eth/runnable/flags.py index 5235685..b84cba7 100644 --- a/chainlib/eth/runnable/flags.py +++ b/chainlib/eth/runnable/flags.py @@ -7,6 +7,8 @@ from hexathon import add_0x cmds = { 'gas': chainlib.eth.cli.argflag_std_write | chainlib.eth.cli.Flag.WALLET, + 'info': chainlib.eth.cli.argflag_reset(chainlib.cli.argflag_std_base_read, chainlib.eth.cli.Flag.CHAIN_SPEC), + 'get': chainlib.eth.cli.argflag_reset(chainlib.cli.argflag_std_base_read, chainlib.eth.cli.Flag.CHAIN_SPEC), } if __name__ == '__main__': diff --git a/chainlib/eth/runnable/get.py b/chainlib/eth/runnable/get.py index d1f9892..d0db644 100644 --- a/chainlib/eth/runnable/get.py +++ b/chainlib/eth/runnable/get.py @@ -48,7 +48,8 @@ logg = logging.getLogger() script_dir = os.path.dirname(os.path.realpath(__file__)) config_dir = os.path.join(script_dir, '..', 'data', 'config') -arg_flags = chainlib.eth.cli.argflag_std_read +arg_flags = chainlib.eth.cli.argflag_std_base_read +arg_flags = chainlib.eth.cli.argflag_reset(arg_flags, chainlib.eth.cli.Flag.CHAIN_SPEC) argparser = chainlib.eth.cli.ArgumentParser(arg_flags) argparser.add_positional('item', type=str, help='Address or transaction to retrieve data for') args = argparser.parse_args() diff --git a/man/get.head.groff b/man/get.head.groff new file mode 100644 index 0000000..a7d1aaf --- /dev/null +++ b/man/get.head.groff @@ -0,0 +1,17 @@ +.TH eth-get 1 + +.SH NAME +eth-get \- Retrieve transaction and transaction state from network + +.SH SYNOPSIS +\fBeth-get\fP [ -p \fIrpc_provider\fP] \fItx_hash\fP + +.SH DESCRIPTION +.P +Retrieve a transaction by its transaction hash. +.P +\fBeth-get\fP retrieves the state of the transaction (the "receipt") and applies it to the output. +.P +It also re-serializes the transaction wire format for reference. + +.SS OPTIONS diff --git a/man/info.head.groff b/man/info.head.groff new file mode 100644 index 0000000..922cb5e --- /dev/null +++ b/man/info.head.groff @@ -0,0 +1,27 @@ +.TH eth-info 1 + +.SH NAME +eth-info - Return key metrics from the current state of the EVM network. + +.SH SYNOPSIS +\fBeth-info\fP [ -p \fIrpc_provider\fP ] [ \fIkey\fP ] + +.SH DESCRIPTION +\fBeth-info\fP reports statistics from the current state of the EVM network: + +.EX +$ eth-info +Block: 1024478 +Gas price: 1000000000 +.EE + +An individual data item may be specified using the \fIkey\fP positional argument: + +.EX +$ eth-info block +Block: 1024478 +$ eth-info --raw gas_price +1000000000 +.EE + +.SS OPTIONS