feat(config): simplify list command and add subcommand aliases

- config list: remove -l/--long option, always display URL
- config list: add ls alias (already existed, kept)
- config delete: add rm alias (alongside existing remove alias)
- README: add config update, config list, config delete sections

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
This commit is contained in:
2026-04-17 18:59:07 +09:00
parent 68670a6588
commit ddb4300d85
2 changed files with 30 additions and 9 deletions
+4 -9
View File
@@ -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: