1+ use std:: sync:: Arc ;
2+
13use clap:: { Args , Subcommand } ;
24use comfy_table:: {
35 ContentArrangement , Row , Table ,
@@ -16,7 +18,7 @@ use stackable_cockpit::{
1618 k8s:: { self , Client } ,
1719 path:: PathOrUrlParseError ,
1820 } ,
19- xfer:: { self , cache :: Cache } ,
21+ xfer,
2022} ;
2123use stackable_operator:: kvp:: { LabelError , Labels } ;
2224use tracing:: { Span , debug, info, instrument} ;
@@ -161,11 +163,13 @@ pub enum CmdError {
161163
162164impl DemoArgs {
163165 #[ instrument( skip_all, fields( with_cache = !cli. no_cache) ) ]
164- pub async fn run ( & self , cli : & Cli , cache : Cache ) -> Result < String , CmdError > {
166+ pub async fn run (
167+ & self ,
168+ cli : & Cli ,
169+ transfer_client : Arc < xfer:: Client > ,
170+ ) -> Result < String , CmdError > {
165171 debug ! ( "Handle demo args" ) ;
166172
167- let transfer_client = xfer:: Client :: new_with ( cache) ;
168-
169173 let release_files = cli. get_release_files ( ) . context ( PathOrUrlParseSnafu ) ?;
170174 let release_list = release:: ReleaseList :: build ( & release_files, & transfer_client)
171175 . await
@@ -201,8 +205,8 @@ impl DemoArgs {
201205 . context ( BuildListSnafu ) ?;
202206
203207 match & self . subcommand {
204- DemoCommands :: List ( args) => list_cmd ( args, cli , list) . await ,
205- DemoCommands :: Describe ( args) => describe_cmd ( args, cli , list) . await ,
208+ DemoCommands :: List ( args) => list_cmd ( args, list) . await ,
209+ DemoCommands :: Describe ( args) => describe_cmd ( args, list) . await ,
206210 DemoCommands :: Install ( args) => {
207211 install_cmd ( args, cli, list, & transfer_client, & release_branch) . await
208212 }
@@ -212,7 +216,7 @@ impl DemoArgs {
212216
213217/// Print out a list of demos, either as a table (plain), JSON or YAML
214218#[ instrument( skip_all, fields( indicatif. pb_show = true ) ) ]
215- async fn list_cmd ( args : & DemoListArgs , cli : & Cli , list : demo:: List ) -> Result < String , CmdError > {
219+ async fn list_cmd ( args : & DemoListArgs , list : demo:: List ) -> Result < String , CmdError > {
216220 info ! ( "Listing demos" ) ;
217221 Span :: current ( ) . pb_set_message ( "Fetching demo information" ) ;
218222
@@ -239,7 +243,7 @@ async fn list_cmd(args: &DemoListArgs, cli: &Cli, list: demo::List) -> Result<St
239243 table. add_row ( row) ;
240244 }
241245
242- let mut result = cli . result ( ) ;
246+ let mut result = Cli :: result ( ) ;
243247
244248 result
245249 . with_command_hint (
@@ -261,11 +265,7 @@ async fn list_cmd(args: &DemoListArgs, cli: &Cli, list: demo::List) -> Result<St
261265
262266/// Describe a specific demo by printing out a table (plain), JSON or YAML
263267#[ instrument( skip_all, fields( indicatif. pb_show = true ) ) ]
264- async fn describe_cmd (
265- args : & DemoDescribeArgs ,
266- cli : & Cli ,
267- list : demo:: List ,
268- ) -> Result < String , CmdError > {
268+ async fn describe_cmd ( args : & DemoDescribeArgs , list : demo:: List ) -> Result < String , CmdError > {
269269 info ! ( demo_name = %args. demo_name, "Describing demo" ) ;
270270 Span :: current ( ) . pb_set_message ( "Fetching demo information" ) ;
271271
@@ -299,7 +299,7 @@ async fn describe_cmd(
299299
300300 // TODO (Techassi): Add parameter output
301301
302- let mut result = cli . result ( ) ;
302+ let mut result = Cli :: result ( ) ;
303303
304304 result
305305 . with_command_hint (
@@ -337,7 +337,7 @@ async fn install_cmd(
337337 Span :: current ( ) . pb_set_message ( "Installing demo" ) ;
338338
339339 // Init result output and progress output
340- let mut output = cli . result ( ) ;
340+ let mut output = Cli :: result ( ) ;
341341
342342 let demo = list. get ( & args. demo_name ) . ok_or ( CmdError :: NoSuchDemo {
343343 name : args. demo_name . clone ( ) ,
0 commit comments