diff --git a/README.md b/README.md index 46ab539..17171ae 100644 --- a/README.md +++ b/README.md @@ -18,6 +18,32 @@ Create remote host configuration mdrs config create neurodata https://neurodata.riken.jp/api ``` +### config update + +Update the URL of a registered remote host. + +```shell +mdrs config update neurodata https://neurodata.riken.jp/api +``` + +### config list + +List registered remote hosts. + +```shell +mdrs config list +mdrs config ls +``` + +### config delete + +Remove a registered remote host. + +```shell +mdrs config delete neurodata +mdrs config rm neurodata +``` + ### login Login to remote host diff --git a/mdrsclient/commands/config.py b/mdrsclient/commands/config.py index d5fd319..8ef6ffe 100644 --- a/mdrsclient/commands/config.py +++ b/mdrsclient/commands/config.py @@ -26,10 +26,9 @@ class ConfigCommand(BaseCommand): update_parser.set_defaults(func=cls.func_update) # config list list_parser = config_parsers.add_parser("list", help="list all the remote hosts", aliases=["ls"]) - list_parser.add_argument("-l", "--long", help="show the api url", action="store_true") list_parser.set_defaults(func=cls.func_list) # config delete - delete_parser = config_parsers.add_parser("delete", help="delete an existing remote host", aliases=["remove"]) + delete_parser = config_parsers.add_parser("delete", help="delete an existing remote host", aliases=["remove", "rm"]) delete_parser.add_argument("remote", help="label of remote host") delete_parser.set_defaults(func=cls.func_delete) @@ -47,8 +46,7 @@ class ConfigCommand(BaseCommand): @classmethod def func_list(cls, args: Namespace) -> None: - is_long = bool(args.long) - cls.list(is_long) + cls.list() @classmethod def func_delete(cls, args: Namespace) -> None: @@ -74,13 +72,10 @@ class ConfigCommand(BaseCommand): config.url = url @classmethod - def list(cls, is_long: bool) -> None: + def list(cls) -> None: config = ConfigFile("") for remote, url in config.list(): - line = f"{remote}:" - if is_long: - line += f"\t{url}" - print(line) + print(f"{remote}:\t{url}") @classmethod def delete(cls, remote: str) -> None: