#include <os/ArgumentParser.h>
#include <sys/syscall.h>
#include <unistd.h>

Result<int> luna_main(int argc, char** argv)
{
    StringView new_root;
    StringView put_old;

    os::ArgumentParser parser;
    parser.add_description("Move the current root directory to another directory and replace it with another mount.");
    parser.add_system_program_info("pivot_root"_sv);
    parser.add_positional_argument(new_root, "new_root", true);
    parser.add_positional_argument(put_old, "put_old", true);
    parser.parse(argc, argv);

    long rc = syscall(SYS_pivot_root, new_root.chars(), put_old.chars());
    return Result<int>::from_syscall(rc);
}