Skip to content

Conversation

@bedla
Copy link
Contributor

@bedla bedla commented Nov 30, 2025

Hi,
I have added this small tweak to help with null or empty values in command array when calling execInContainer(...) method.
This will help me (and others), to write more concise code like this:

minioContainer.execInContainer(
            "mc", debug(),
            "mb", "--region=eu-central-1",
            "$alias/mynewbucket"
        ).requireSuccess()
            .also { println(it) }

        private fun debug() = if (false) {
            "--debug"
        } else {
            null
        }

Instead of creating another array to be able to IF values:

        String[] command1 = new String[5];
        command1[0] = "mc";
        command1[1] = debug();
        command1[2] = "mb";
        command1[3] = "--region=eu-central-1";
        command1[4] = "$alias/mynewbucket";

        String[] command2 = new String[]{"mc", debug(), "mb", "--region=eu-central-1", "$alias/mynewbucket"};
        minioContainer.execInContainer(command1);

What do you think?

Thx

Ivos

@bedla bedla requested a review from a team as a code owner November 30, 2025 16:49
@bedla bedla force-pushed the feature/execincontainer-skip-nulls branch from eb30bc1 to 8d93525 Compare November 30, 2025 17:07
@bedla bedla force-pushed the feature/execincontainer-skip-nulls branch from 8d93525 to ce32e63 Compare December 21, 2025 19:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant