1111import click
1212from rich .tree import Tree
1313
14+ from orca_cli .core .aliases import add_command_with_alias
1415from orca_cli .core .context import OrcaContext
1516from orca_cli .core .exceptions import OrcaCLIError
1617from orca_cli .core .output import console , output_options , print_detail , print_list
@@ -80,7 +81,12 @@ def object_stats(ctx: click.Context, output_format: str, columns: tuple[str, ...
8081# ── container-list ───────────────────────────────────────────────────────────
8182
8283
83- @object_store .command ("container-list" )
84+ @object_store .group ("container" )
85+ def object_container () -> None :
86+ """Manage Swift containers."""
87+
88+
89+ @object_container .command ("list" )
8490@output_options
8591@click .pass_context
8692def container_list (ctx : click .Context , output_format : str , columns : tuple [str , ...], fit_width : bool , max_width : int | None , noindent : bool ) -> None :
@@ -109,7 +115,7 @@ def container_list(ctx: click.Context, output_format: str, columns: tuple[str, .
109115# ── container-show ───────────────────────────────────────────────────────────
110116
111117
112- @object_store .command ("container- show" )
118+ @object_container .command ("show" )
113119@click .argument ("container" )
114120@output_options
115121@click .pass_context
@@ -141,7 +147,7 @@ def container_show(ctx: click.Context, container: str, output_format: str, colum
141147# ── container-create ─────────────────────────────────────────────────────────
142148
143149
144- @object_store .command ("container- create" )
150+ @object_container .command ("create" )
145151@click .argument ("container" )
146152@click .pass_context
147153def container_create (ctx : click .Context , container : str ) -> None :
@@ -155,7 +161,7 @@ def container_create(ctx: click.Context, container: str) -> None:
155161# ── container-delete ─────────────────────────────────────────────────────────
156162
157163
158- @object_store .command ("container- delete" )
164+ @object_container .command ("delete" )
159165@click .argument ("container" )
160166@click .option ("--recursive" , is_flag = True , default = False , help = "Delete all objects before deleting the container." )
161167@click .option ("--yes" , "-y" , is_flag = True , help = "Skip confirmation prompt." )
@@ -186,7 +192,7 @@ def container_delete(ctx: click.Context, container: str, recursive: bool, yes: b
186192# ── container-set ────────────────────────────────────────────────────────────
187193
188194
189- @object_store .command ("container- set" )
195+ @object_container .command ("set" )
190196@click .argument ("container" )
191197@click .option ("--property" , "properties" , multiple = True , required = True , help = "Metadata key=value pair (repeatable)." )
192198@click .pass_context
@@ -209,7 +215,7 @@ def container_set(ctx: click.Context, container: str, properties: tuple[str, ...
209215# ── container-save ───────────────────────────────────────────────────────────
210216
211217
212- @object_store .command ("container- save" )
218+ @object_container .command ("save" )
213219@click .argument ("container" )
214220@click .option ("--output-dir" , default = "." , show_default = True , help = "Local directory to save objects into." )
215221@click .pass_context
@@ -593,7 +599,12 @@ def object_unset(ctx: click.Context, container: str, object_name: str, propertie
593599# ── account-set ───────────────────────────────────────────────────────────────
594600
595601
596- @object_store .command ("account-set" )
602+ @object_store .group ("account" )
603+ def object_account () -> None :
604+ """Manage Swift account-level metadata."""
605+
606+
607+ @object_account .command ("set" )
597608@click .option ("--property" , "properties" , multiple = True , required = True , help = "Metadata key=value pair (repeatable)." )
598609@click .pass_context
599610def object_account_set (ctx : click .Context , properties : tuple [str , ...]) -> None :
@@ -615,7 +626,7 @@ def object_account_set(ctx: click.Context, properties: tuple[str, ...]) -> None:
615626# ── account-unset ─────────────────────────────────────────────────────────────
616627
617628
618- @object_store .command ("account- unset" )
629+ @object_account .command ("unset" )
619630@click .option ("--property" , "properties" , multiple = True , required = True , help = "Metadata key to remove (repeatable)." )
620631@click .pass_context
621632def object_account_unset (ctx : click .Context , properties : tuple [str , ...]) -> None :
@@ -694,3 +705,31 @@ def _add_nodes(parent_tree: Tree, subtree: dict) -> None:
694705
695706 _add_nodes (tree , folder_tree )
696707 console .print (tree )
708+
709+
710+ # ── ADR-0008 deprecated aliases (backward compatibility) ────────────────
711+
712+ add_command_with_alias (object_store , container_list ,
713+ legacy_name = "container-list" ,
714+ primary_path = "object container list" )
715+ add_command_with_alias (object_store , container_show ,
716+ legacy_name = "container-show" ,
717+ primary_path = "object container show" )
718+ add_command_with_alias (object_store , container_create ,
719+ legacy_name = "container-create" ,
720+ primary_path = "object container create" )
721+ add_command_with_alias (object_store , container_delete ,
722+ legacy_name = "container-delete" ,
723+ primary_path = "object container delete" )
724+ add_command_with_alias (object_store , container_set ,
725+ legacy_name = "container-set" ,
726+ primary_path = "object container set" )
727+ add_command_with_alias (object_store , container_save ,
728+ legacy_name = "container-save" ,
729+ primary_path = "object container save" )
730+ add_command_with_alias (object_store , object_account_set ,
731+ legacy_name = "account-set" ,
732+ primary_path = "object account set" )
733+ add_command_with_alias (object_store , object_account_unset ,
734+ legacy_name = "account-unset" ,
735+ primary_path = "object account unset" )
0 commit comments