chainlib

Generic blockchain access library and tooling
Log | Files | Refs | README | LICENSE

commit f21b4f9fd2e9ec41292d76d36f9659b208417b06
parent 791bb6e1bbb53dd3da7ec130f1b79babc579d551
Author: lash <dev@holbrook.no>
Date:   Mon, 13 Feb 2023 14:45:01 +0000

ensure execute only for single module in find cli

Diffstat:
Mchainlib/runnable/find.py | 6+++---
Msetup.cfg | 4++++
Msetup.py | 1+
3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/chainlib/runnable/find.py b/chainlib/runnable/find.py @@ -12,11 +12,11 @@ logg = logging.getLogger() ap = argparse.ArgumentParser() -ap.add_argument('-m', '--module', type=str, action='append', help='module name to add to filter (default all modules match)') +ap.add_argument('--cmd', type=str, help='command to execute on module. default command will be executed if not specified') ap.add_argument('--arg', type=str, action='append', help='argument for command to execute') ap.add_argument('-v', action='store_true', help='verbose logging') ap.add_argument('-vv', action='store_true', help='very verbose logging') -ap.add_argument('command', type=str, nargs='?', help='command to pass to module execution handler') +ap.add_argument('module', type=str, help='module to locate and execute') args = ap.parse_args(sys.argv[1:]) if args.vv: @@ -36,7 +36,7 @@ def default_handler(m, cmd, args): def main(): - find_chainlib_modules(fltr=args.module, cmd=args.command, args=args.arg, handler=default_handler) + find_chainlib_modules(fltr=[args.module], cmd=args.cmd, args=args.arg, handler=default_handler) if __name__ == '__main__': diff --git a/setup.cfg b/setup.cfg @@ -20,3 +20,7 @@ classifiers = Intended Audience :: Developers License :: OSI Approved :: GNU Affero General Public License v3 or later (AGPLv3+) Topic :: Internet + +[options.entry_points] +console_scripts = + chainlib-find = chainlib.runnable.find:main diff --git a/setup.py b/setup.py @@ -23,6 +23,7 @@ setup( packages = [ 'chainlib', 'chainlib.cli', + 'chainlib.runnable', ], scripts = [ 'scripts/chainlib-man.py',