diff --git a/planutils/__init__.py b/planutils/__init__.py index 6dbd33b..c7b6ed3 100644 --- a/planutils/__init__.py +++ b/planutils/__init__.py @@ -89,6 +89,9 @@ def main(): parser_remote.add_argument('package', help='package name') parser_remote.add_argument('options', help='commandline options for the package', nargs="*") + parser_remote_list = subparsers.add_parser('remote-list', help='list the available remote packages') + + parser_checkinstalled = subparsers.add_parser('check-installed', help='check if a package is installed') parser_checkinstalled.add_argument('package', help='package name') @@ -124,6 +127,10 @@ def main(): from planutils.package_installation import remote remote(args.package, args.options) + elif 'remote-list' == args.command: + from planutils.package_installation import package_remote_list + package_remote_list() + elif 'list' == args.command: from planutils.package_installation import package_list package_list() diff --git a/planutils/package_installation.py b/planutils/package_installation.py index 4d01772..f1d76b4 100644 --- a/planutils/package_installation.py +++ b/planutils/package_installation.py @@ -193,6 +193,16 @@ def run(target, options): sys.exit(f"Package {target} is not executable") subprocess.run([Path(settings.PLANUTILS_PREFIX) / "packages" / target / "run"] + options) +def package_remote_list(): + + package_url = settings.PAAS_SERVER + "/package" + r = requests.get(package_url) + remote_packages = r.json() + + print("\nDeployed:") + for p in remote_packages: + arguments = " ".join(f'{{{a["name"]}}} ' for a in p['endpoint']['services']['solve']['args']) + print(" %s: %s\n\tArguments: %s" % (p['package_name'], p['name'], arguments )) def remote(target, options):