#include "ViewerApp.hpp"

#include <CLI/App.hpp>
#include <CLI/Config.hpp>
#include <CLI/Formatter.hpp>

int main(int argc, char** argv) {
    osim_viewer::CliOptions options;

    CLI::App cli{"Read-only OpenSim viewer"};
    cli.add_option("model", options.modelPath, "Path to model .osim")->required()->check(CLI::ExistingFile);
    cli.add_option("motion", options.motionPath, "Path to motion .mot")->required()->check(CLI::ExistingFile);
    cli.add_option("--geometry-dir", options.geometryDirs, "Additional geometry search directories");
    cli.add_option("--speed", options.initialSpeed, "Initial playback speed")->check(CLI::PositiveNumber);
    cli.add_flag("--start-paused", options.startPaused, "Start paused at t=0");

    CLI11_PARSE(cli, argc, argv);

    osim_viewer::ViewerApp app({argc, argv}, std::move(options));
    return app.exec();
}

