summaryrefslogtreecommitdiff
path: root/src/main.cc
diff options
context:
space:
mode:
authorSiddarth Suresh <155843085+SiddarthSuresh98@users.noreply.github.com>2025-03-21 14:21:06 -0400
committerGitHub <noreply@github.com>2025-03-21 14:21:06 -0400
commit24e8a72b40cb185de04821f31be65b0ec8768fb7 (patch)
treeffd8e0bd2b112180251804a096f601f745f9af1b /src/main.cc
parent89b9d1e4592d11cd6146b1bc3b3c12e241e574d3 (diff)
parentcf3ac49639bef5082489068e2d92a4d86f42080b (diff)
Merge pull request #27 from bdunahu/bdunahu
Make memory simulator an optional command, switch to test fixtures Changes look good
Diffstat (limited to 'src/main.cc')
-rw-r--r--src/main.cc43
1 files changed, 22 insertions, 21 deletions
diff --git a/src/main.cc b/src/main.cc
index 08b38e6..f5eecac 100644
--- a/src/main.cc
+++ b/src/main.cc
@@ -1,6 +1,6 @@
#include "cli.h"
-#include "logger.h"
#include "definitions.h"
+#include "logger.h"
#include <getopt.h>
#include <iostream>
@@ -22,36 +22,39 @@ static std::string banner =
" _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ _/ \n"
" _/ _/ _/_/_/_/ _/_/_/ _/ _/_/ _/ _/ _/ \n"
" _/_/ _/_/ ";
-static void print_version_number() { std::cout << banner << version_number << '\n'; }
+static void print_version_number()
+{
+ std::cout << banner << version_number << '\n';
+}
static void err()
{
std::cerr << "Usage:\n\trisc_vector [OPTIONS]\nOptions:\n\t--debug,\t-d: "
- "turn on verbose output\n\t--no-python,\t-p: run without "
- "GUI\n\t--version,\t-v: print the version information and exit\n"
+ "turn on verbose output\n\t--memory-only,\t-m: run the memory "
+ "simulator only, without a GUI.\n\t--version,\t-v: print the "
+ "version information and exit\n"
<< std::endl;
}
-static void parseArguments(int argc, char **argv, bool &python)
+static void
+parseArguments(int argc, char **argv, bool &memory_only)
{
struct option long_options[] = {
{"debug", no_argument, 0, 'd'},
- {"no-python", no_argument, 0, 'p'},
+ {"memory-only", no_argument, 0, 'm'},
{0, 0, 0, 0}};
- python = true;
-
int opt;
- while ((opt = getopt_long(argc, argv, "d:p", long_options, NULL)) != -1) {
+ while ((opt = getopt_long(argc, argv, "d:m", long_options, NULL)) != -1) {
switch (opt) {
case 'd':
global_log->setLevel(DEBUG);
global_log->log(DEBUG, "DEBUG output enabled.");
break;
- case 'p':
- global_log->log(INFO, "Python will NOT be started!");
- python = false;
+ case 'm':
+ global_log->log(INFO, "Starting the storage CLI interface...");
+ memory_only = true;
break;
default:
err();
@@ -63,20 +66,18 @@ static void parseArguments(int argc, char **argv, bool &python)
int main(int argc, char **argv)
{
print_version_number();
- Cli cli;
global_log->log(INFO, "Initializing...");
- bool python = true;
- parseArguments(argc, argv, python);
+ bool memory_only = false;
+ parseArguments(argc, argv, memory_only);
- if (python) {
- // fork off python here
- ;
- global_log->log(INFO, "Python started.");
+ if (memory_only) {
+ Cli cli;
+ cli.run();
}
- cli.run();
-
+ // fork off python here
+ global_log->log(INFO, "Python started.");
global_log->log(INFO, "Cleaning up...");
global_log->log(INFO, "Goodbye!");
return EXIT_SUCCESS;