@@ -122,3 +122,86 @@ async def get_drivers(output: OutputType):
122122 click .echo (f"driver.jumpstarter.dev/{ package .name } /{ driver .name } " )
123123 case _:
124124 print_drivers (local_drivers , is_wide = output == OutputMode .WIDE )
125+
126+
127+ def print_driver_clients (driver_packages : DriverPackageList , is_wide : bool ):
128+ if is_wide :
129+ columns = ["NAME" , "PACKAGE" , "VERSION" , "TYPE" , "CATEGORIES" , "LICENSE" ]
130+ else :
131+ columns = ["NAME" , "TYPE" ]
132+ driver_rows = []
133+ for package in driver_packages .items :
134+ for client in package .clients :
135+ driver_rows .append (
136+ {
137+ "NAME" : client .name ,
138+ "PACKAGE" : package .name ,
139+ "VERSION" : package .version ,
140+ "TYPE" : client .type ,
141+ "CATEGORIES" : "," .join (package .categories ),
142+ "LICENSE" : package .license if package .license else "Unspecified" ,
143+ }
144+ )
145+ click .echo (make_table (columns , driver_rows ))
146+
147+
148+ @get .command ("driver-clients" )
149+ @opt_output_all
150+ @handle_exceptions
151+ async def get_driver_clients (output : OutputType ):
152+ """
153+ Display all available driver clients.
154+ """
155+ local_repo = LocalDriverRepository .from_venv ()
156+ local_drivers = local_repo .list_packages ()
157+ match output :
158+ case OutputMode .JSON :
159+ click .echo (local_drivers .dump_json ())
160+ case OutputMode .YAML :
161+ click .echo (local_drivers .dump_yaml ())
162+ case OutputMode .NAME :
163+ for package in local_drivers .items :
164+ for driver in package .drivers :
165+ click .echo (f"driver-client.jumpstarter.dev/{ package .name } /{ driver .name } " )
166+ case _:
167+ print_driver_clients (local_drivers , is_wide = output == OutputMode .WIDE )
168+
169+
170+ def print_packages (local_drivers : DriverPackageList , is_wide : bool ):
171+ if is_wide :
172+ columns = ["NAME" , "VERSION" , "LICENSE" , "CATEGORIES" ]
173+ else :
174+ columns = ["NAME" , "VERSION" , "LICENSE" , "CATEGORIES" ]
175+ driver_rows = []
176+ for package in local_drivers .items :
177+ driver_rows .append (
178+ {
179+ "NAME" : package .name ,
180+ "VERSION" : package .version ,
181+ "CATEGORIES" : "," .join (package .categories ),
182+ "LICENSE" : package .license if package .license else "Unspecified" ,
183+ }
184+ )
185+ click .echo (make_table (columns , driver_rows ))
186+
187+
188+ @get .command ("packages" )
189+ @opt_output_all
190+ @handle_exceptions
191+ async def get_packages (output : OutputType ):
192+ """
193+ Display all available jumpstarter driver packages.
194+ """
195+ local_repo = LocalDriverRepository .from_venv ()
196+ local_drivers = local_repo .list_packages ()
197+ match output :
198+ case OutputMode .JSON :
199+ click .echo (local_drivers .dump_json ())
200+ case OutputMode .YAML :
201+ click .echo (local_drivers .dump_yaml ())
202+ case OutputMode .NAME :
203+ for package in local_drivers .items :
204+ for driver in package .drivers :
205+ click .echo (f"driver.jumpstarter.dev/{ package .name } /{ driver .name } " )
206+ case _:
207+ print_packages (local_drivers , is_wide = output == OutputMode .WIDE )
0 commit comments