Cleaning up initial commit and restructured some of the execution flow, fixed returns and reference mgmt

This commit is contained in:
Chris Punches
2025-02-23 03:26:49 -05:00
parent 1ce163ef29
commit 932c40275f
7 changed files with 292 additions and 105 deletions

View File

@@ -2,10 +2,22 @@
#include <string>
#include <cstring>
#include <vector>
#include "../include/module_interface.hpp"
#include <gpgme.h>
// Implementation of the info module
// This module provides information about the DPM system
// Version information
extern "C" const char* dpm_module_get_version(void) {
return "0.1.0";
}
// Module description
extern "C" const char* dpm_get_description(void) {
return "DPM Info Module - Provides information about the DPM system";
}
// Main entry point that will be called by DPM
extern "C" int dpm_module_execute(const char* command, int argc, char** argv) {
// Handle the case when no command is provided
@@ -30,7 +42,7 @@ extern "C" int dpm_module_execute(const char* command, int argc, char** argv) {
}
else if (cmd == "system") {
std::cout << "System Information:\n";
std::cout << " OS: " <<
std::cout << " OS: "
#ifdef _WIN32
"Windows"
#elif __APPLE__
@@ -41,7 +53,7 @@ extern "C" int dpm_module_execute(const char* command, int argc, char** argv) {
"Unknown"
#endif
<< "\n";
std::cout << " Architecture: " <<
std::cout << " Architecture: "
#ifdef __x86_64__
"x86_64"
#elif __i386__
@@ -69,4 +81,4 @@ extern "C" int dpm_module_execute(const char* command, int argc, char** argv) {
std::cerr << "Run 'dpm info help' for a list of available commands\n";
return 1;
}
}
}