#include "sh.h"
#include <os/ArgumentParser.h>
#include <stdio.h>

void print_sequenced(const char* string, bool& state)
{
    if (!state) { putchar(' '); }
    state = false;
    fputs(string, stdout);
}

shell_builtin_t builtin_echo = [](int argc, char** argv) -> Result<void> {
    bool state = true;

    for (int i = 1; i < argc; i++) { print_sequenced(argv[i], state); }

    putchar('\n');

    return {};
};