Files
deargui-vpl/examples/blueprints-example/blueprints_cli.h
T

56 lines
1.7 KiB
C++

#pragma once
#include "blueprints_engine.h"
#include "application.h"
#include <string>
/**
* BlueprintsCLI - Command-line interface for blueprints engine
*
* Provides headless operations on graphs without requiring GUI/rendering.
* Inherits from BlueprintsEngine to access core graph operations.
*
* Usage:
* BlueprintsCLI cli(args);
* return cli.Execute();
*/
class BlueprintsCLI : public BlueprintsEngine
{
public:
explicit BlueprintsCLI(const ArgsMap& args);
/**
* Execute the CLI command
* @return Exit code (0 = success, non-zero = error)
*/
int Execute();
private:
ArgsMap m_Args;
// Helper to extract string argument
std::string GetStringArg(const std::string& key, const std::string& defaultValue = "") const;
// Helper to extract bool argument
bool GetBoolArg(const std::string& key, bool defaultValue = false) const;
// Command implementations
int CommandValidate();
int CommandExport();
int CommandExecute();
int CommandInfo();
int CommandHelp();
// Output helpers
void PrintError(const std::string& message);
void PrintSuccess(const std::string& message);
void PrintInfo(const std::string& message);
};
// Helper functions (can be used outside CLI class)
std::string GetStringArg(const ArgsMap& args, const std::string& key, const std::string& defaultValue = "");
bool GetBoolArg(const ArgsMap& args, const std::string& key, bool defaultValue = false);
int GetIntArg(const ArgsMap& args, const std::string& key, int defaultValue = 0);
double GetDoubleArg(const ArgsMap& args, const std::string& key, double defaultValue = 0.0);