4040import lombok .Cleanup ;
4141import lombok .Getter ;
4242import lombok .SneakyThrows ;
43- import lombok .experimental .Accessors ;
4443import lombok .val ;
4544import org .apache .commons .lang3 .ArrayUtils ;
4645import org .apache .commons .lang3 .tuple .Pair ;
5453
5554import java .nio .file .FileSystems ;
5655import java .nio .file .Files ;
56+ import java .sql .DataTruncation ;
5757import java .util .Arrays ;
5858import java .util .Optional ;
5959import java .util .StringJoiner ;
@@ -142,7 +142,7 @@ public static void main(String... args) {
142142 CliPropertiesImpl .mkAndLoadSysProps (cliEnv , MemoizedCliProperties ::new ),
143143 OutputType .HUMAN ,
144144 new AstraColors (Ansi .AUTO ),
145- new AstraLogger (Level .REGULAR , getCtx , false , Optional .empty (), Optional .empty ()),
145+ new AstraLogger (Level .REGULAR , cliEnv , getCtx , false , Optional .empty (), Optional .empty ()),
146146 new AstraConsole (System .in , mkPrintWriter (System .out , "stdout" ), mkPrintWriter (System .err , "stderr" ), null , getCtx , false ),
147147 new AstraHome (getCtx ),
148148 FileSystems .getDefault (),
@@ -155,7 +155,6 @@ public static void main(String... args) {
155155 }
156156
157157 @ Getter
158- @ Accessors (fluent = true )
159158 private static @ Nullable Supplier <CliContext > unsafeGlobalCliContext ;
160159
161160 @ SneakyThrows
@@ -182,8 +181,8 @@ public static int run(Ref<CliContext> ctxRef, String... args) {
182181 .setOverwrittenOptionsAllowed (true );
183182
184183 ctxRef .nowAndOnUpdate ((ctx ) -> {
185- cmd .setOut (ctx .console ().getOut ());
186- cmd .setErr (ctx .console ().getErr ());
184+ cmd .setOut (ctx .console ().stdout ());
185+ cmd .setErr (ctx .console ().stderr ());
187186 });
188187
189188 cmd .getSubcommands ().get ("help" ).getCommandSpec ().usageMessage ().hidden (true );
@@ -236,26 +235,26 @@ public static <T> T exit(int exitCode) {
236235
237236 public static class SetupExampleProvider implements ExampleProvider {
238237 @ Override
239- public Pair <String , String > get (CliContext ctx ) {
238+ public Pair <String , String [] > get (CliContext ctx ) {
240239 if (System .getProperty ("cli.testing" ) == null ) { // keeps output deterministic for testing
241240 try {
242241 val configFileExists = Files .exists (AstraConfig .resolveDefaultAstraConfigFile (ctx ));
243242
244243 if (!configFileExists ) {
245- return Pair .of ("Setup the Astra CLI" , "${cli.name} setup" );
244+ return Pair .of ("Setup the Astra CLI" , new String [] { "${cli.name} setup" } );
246245 }
247246
248247 val autocompleteSetup = System .getenv (ConstEnvVars .COMPLETIONS_SETUP ) != null ;
249248
250249 if (!autocompleteSetup && ctx .isNotWindows ()) {
251- return Pair .of ("Put this in your shell profile to generate completions and more!" , "eval \" $(${cli.path} shellenv)\" " );
250+ return Pair .of ("Put this in your shell profile to generate completions and more!" , new String [] { "eval \" $(${cli.path} shellenv)\" " } );
252251 }
253252 } catch (Exception e ) {
254253 ctx .log ().exception ("Error resolving main example for AstraCli" , e );
255254 }
256255 }
257256
258- return Pair .of ("Create a new profile" , "${cli.name} setup" );
257+ return Pair .of ("Create a new profile" , new String [] { "${cli.name} setup" } );
259258 }
260259 }
261260}
0 commit comments