added ls to help output

This commit is contained in:
lucaspalomodevelop 2023-05-06 23:35:58 +02:00
parent 459132eb8e
commit 3ce6f71757
2 changed files with 9 additions and 0 deletions

View File

@ -22,6 +22,7 @@ void input(int argc, char *argv[])
command.addCommand("run", runScript); command.addCommand("run", runScript);
command.addCommand("help", help); command.addCommand("help", help);
command.addCommand("ls", listScripts); command.addCommand("ls", listScripts);
command.addCommand("add", addScript);
command.addDefaultCommand(runScript); command.addDefaultCommand(runScript);
command.runCommand(argv[1], argc, argv); command.runCommand(argv[1], argc, argv);
} }
@ -48,6 +49,13 @@ void listScripts(int argc, char *argv[])
} }
} }
// add a script to the autom directory
void addScript(int argc, char *argv[])
{
std::string scriptname = argv[2];
std::ofstream{dir + "/" + scriptname};
}
// help function for showing help message // help function for showing help message
void help(int argc, char *argv[]) void help(int argc, char *argv[])
{ {

View File

@ -3,6 +3,7 @@
#include <string> #include <string>
#include <sys/stat.h> #include <sys/stat.h>
#include <filesystem> #include <filesystem>
#include <fstream>
#include "inputparser.h" #include "inputparser.h"
#include "command.h" #include "command.h"