conda list envs

#include <cstdlib>
#include <iostream>
#include <string>

int main() {
    // Execute the command "conda list envs" and store the output in a pipe
    FILE* pipe = popen("conda list envs", "r");
    if (!pipe) return 1;

    // Create a buffer to store the output
    char buffer[128];
    std::string result = "";

    // Read the output of the command into the buffer
    while (!feof(pipe)) {
        if (fgets(buffer, 128, pipe) != nullptr)
            result += buffer;
    }

    // Close the pipe
    pclose(pipe);

    // Print the result
    std::cout << result;

    return 0;
}