|
Harmony
HARMONic stabilitY assessment of PE-penetrated power systems
|
Command-line interface for the unified Harmony executable. More...
#include <filesystem>#include <functional>#include <optional>#include <string>#include <vector>

Go to the source code of this file.
Classes | |
| struct | CliOptions |
Typedefs | |
| using | ExampleFn = std::function< void(bool plotting_enabled)> |
Functions | |
| void | initCliPaths (const char *argv0) |
| Resolve executable location for repo-root detection (call once from main). | |
| std::optional< std::filesystem::path > | harmonyRepoRoot () |
| Detected Harmony repository root, if any. | |
| CliOptions | parseCli (int argc, char *argv[]) |
| Parse argc/argv into CliOptions. | |
| void | printCliHelp () |
| Print usage text to stdout. | |
| void | listCppExamples () |
| List registered C++ examples. | |
| std::vector< std::string > | cppExampleNames () |
| Registered C++ example names (sorted). | |
| void | listJsonFiles (const std::vector< std::filesystem::path > &searchPaths) |
| List JSON files found under configured search paths. | |
| std::vector< std::filesystem::path > | discoverJsonFiles (const std::vector< std::filesystem::path > &searchPaths) |
Discover .json files under searchPaths (sorted, unique). | |
| bool | validateJsonFile (const std::filesystem::path &jsonPath, std::string &errorOut) |
| Parse and schema-validate a JSON simulation file. | |
| int | runCppExample (const std::string &name, bool plot, bool verbose) |
| Run a named C++ example. | |
| int | runJsonSimulation (const std::filesystem::path &jsonPath, bool verbose, bool plot=true, bool waitForPlotClose=true) |
| Run a JSON simulation file. | |
| std::vector< std::filesystem::path > | builtinJsonSearchPaths () |
| Built-in JSON search directories (used when env/CLI overrides are unset). | |
| std::vector< std::filesystem::path > | jsonSearchPathsFromEnvironment () |
Paths from HARMONY_JSON_PATH, or empty if the variable is unset. | |
| std::vector< std::filesystem::path > | defaultJsonSearchPaths () |
Default paths: HARMONY_JSON_PATH if set, otherwise builtinJsonSearchPaths. | |
| std::vector< std::filesystem::path > | buildJsonSearchPaths (const std::vector< std::filesystem::path > &jsonPathOverrides, const std::vector< std::filesystem::path > &extraSearchPaths) |
| Build the effective JSON search path list for one invocation. | |
| std::filesystem::path | resolveJsonPath (const std::string &input, const std::vector< std::filesystem::path > &searchPaths) |
| Resolve a JSON path (absolute, relative, or filename in search paths). | |
| void | printJsonNotFoundHelp (const std::string &input, const std::vector< std::filesystem::path > &searchPaths) |
| Print why a JSON file was not found (search paths, repo root, env). | |
Command-line interface for the unified Harmony executable.
| using ExampleFn = std::function<void(bool plotting_enabled)> |
| std::vector< std::filesystem::path > buildJsonSearchPaths | ( | const std::vector< std::filesystem::path > & | jsonPathOverrides, |
| const std::vector< std::filesystem::path > & | extraSearchPaths | ||
| ) |
Build the effective JSON search path list for one invocation.
| jsonPathOverrides | If non-empty, replaces defaults (--json-path). |
| extraSearchPaths | Appended after defaults (--search-path). |
References builtinJsonSearchPaths(), and jsonSearchPathsFromEnvironment().
Referenced by parseCli().
| std::vector< std::filesystem::path > builtinJsonSearchPaths | ( | ) |
Built-in JSON search directories (used when env/CLI overrides are unset).
Referenced by buildJsonSearchPaths(), and defaultJsonSearchPaths().
| std::vector< std::string > cppExampleNames | ( | ) |
Registered C++ example names (sorted).
Referenced by listCppExamples().
| std::vector< std::filesystem::path > defaultJsonSearchPaths | ( | ) |
Default paths: HARMONY_JSON_PATH if set, otherwise builtinJsonSearchPaths.
References builtinJsonSearchPaths(), and jsonSearchPathsFromEnvironment().
| std::vector< std::filesystem::path > discoverJsonFiles | ( | const std::vector< std::filesystem::path > & | searchPaths | ) |
Discover .json files under searchPaths (sorted, unique).
| std::optional< std::filesystem::path > harmonyRepoRoot | ( | ) |
Detected Harmony repository root, if any.
Referenced by listJsonFiles(), printJsonNotFoundHelp(), and resolveJsonPath().
| void initCliPaths | ( | const char * | argv0 | ) |
Resolve executable location for repo-root detection (call once from main).
Referenced by main(), and runHarmonyLauncher().
| std::vector< std::filesystem::path > jsonSearchPathsFromEnvironment | ( | ) |
Paths from HARMONY_JSON_PATH, or empty if the variable is unset.
Referenced by buildJsonSearchPaths(), and defaultJsonSearchPaths().
| void listCppExamples | ( | ) |
| void listJsonFiles | ( | const std::vector< std::filesystem::path > & | searchPaths | ) |
List JSON files found under configured search paths.
References harmonyRepoRoot().
Referenced by main().
| CliOptions parseCli | ( | int | argc, |
| char * | argv[] | ||
| ) |
Parse argc/argv into CliOptions.
References buildJsonSearchPaths(), CliOptions::Cpp, CliOptions::extraSearchPaths, CliOptions::Help, CliOptions::Json, CliOptions::jsonPathOverrides, CliOptions::ListCpp, CliOptions::ListJson, CliOptions::mode, CliOptions::plot, CliOptions::searchPaths, CliOptions::target, and CliOptions::verbose.
Referenced by main().
| void printCliHelp | ( | ) |
| void printJsonNotFoundHelp | ( | const std::string & | input, |
| const std::vector< std::filesystem::path > & | searchPaths | ||
| ) |
Print why a JSON file was not found (search paths, repo root, env).
References harmonyRepoRoot().
Referenced by main().
| std::filesystem::path resolveJsonPath | ( | const std::string & | input, |
| const std::vector< std::filesystem::path > & | searchPaths | ||
| ) |
Resolve a JSON path (absolute, relative, or filename in search paths).
References harmonyRepoRoot().
Referenced by main().
| int runCppExample | ( | const std::string & | name, |
| bool | plot, | ||
| bool | verbose | ||
| ) |
| int runJsonSimulation | ( | const std::filesystem::path & | jsonPath, |
| bool | verbose, | ||
| bool | plot = true, |
||
| bool | waitForPlotClose = true |
||
| ) |
Run a JSON simulation file.
| waitForPlotClose | When true (CLI default), block until the plot window closes. |
References SimulationBuilder::buildFromJSON(), Network::printConnections(), Network::printElements(), SimulationBuilder::runComputationsWithStatus(), visualization_is_running(), and visualization_wait().
Referenced by main().
| bool validateJsonFile | ( | const std::filesystem::path & | jsonPath, |
| std::string & | errorOut | ||
| ) |
Parse and schema-validate a JSON simulation file.
References JsonValidator::validateRoot().