diff --git a/docs/ramalama-login.1.md b/docs/ramalama-login.1.md index 03e80c87..062bc607 100644 --- a/docs/ramalama-login.1.md +++ b/docs/ramalama-login.1.md @@ -7,7 +7,7 @@ ramalama\-login - login to remote registry **ramalama login** [*options*] [*registry*] ## DESCRIPTION -login to remote registry +login to remote model registry ## OPTIONS Options are specific to registry types. diff --git a/docs/ramalama-logout.1.md b/docs/ramalama-logout.1.md index 592ab0de..875d410e 100644 --- a/docs/ramalama-logout.1.md +++ b/docs/ramalama-logout.1.md @@ -4,7 +4,7 @@ ramalama\-logout - logout from remote registry ## SYNOPSIS -**ramalama logout** [*options*] +**ramalama logout** [*options*] [*registry*] ## DESCRIPTION Logout to remote model registry diff --git a/ramalama/cli.py b/ramalama/cli.py index 77de9a35..0573036d 100644 --- a/ramalama/cli.py +++ b/ramalama/cli.py @@ -275,10 +275,12 @@ def login_parser(subparsers): def normalize_registry(registry): - if registry in ["", "ollama", "hf" "huggingface"]: - return registry - if registry.startswith("oci://"): + if not registry or registry == "" or registry.startswith("oci://"): + return "oci://" + + if registry in ["ollama", "hf" "huggingface"]: return registry + return "oci://" + registry @@ -294,13 +296,13 @@ def logout_parser(subparsers): # Do not run in a container parser.add_argument("--container", default=False, action="store_false", help=argparse.SUPPRESS) parser.add_argument("--token", help="token for registry") - parser.add_argument("TRANSPORT", nargs="?", type=str, default=config.get("transport")) # positional argument + parser.add_argument("REGISTRY", nargs="?", type=str, help="OCI Registry where AI models are stored") parser.set_defaults(func=logout_cli) def logout_cli(args): - transport = args.TRANSPORT - model = New(str(transport), args) + registry = normalize_registry(args.REGISTRY) + model = New(registry, args) return model.logout(args) diff --git a/ramalama/oci.py b/ramalama/oci.py index f9a4e38b..656e4382 100644 --- a/ramalama/oci.py +++ b/ramalama/oci.py @@ -139,7 +139,8 @@ def login(self, args): conman_args.extend([f"--password={args.password}"]) if args.passwordstdin: conman_args.append("--password-stdin") - conman_args.append(args.REGISTRY.removeprefix(prefix)) + if args.REGISTRY: + conman_args.append(args.REGISTRY.removeprefix(prefix)) return exec_cmd(conman_args, debug=args.debug) def logout(self, args):