33 lines
789 B
C++
33 lines
789 B
C++
|
/**
|
||
|
Little snippet for library use.
|
||
|
*/
|
||
|
|
||
|
#include <cstdlib>
|
||
|
#include <iostream>
|
||
|
#include "../msh-console-library/shell.h"
|
||
|
#include "../msh-console-library/command.h"
|
||
|
#include "cmds.h"
|
||
|
using namespace std;
|
||
|
using namespace Cmds;
|
||
|
|
||
|
static void setup(Shell *);
|
||
|
|
||
|
int main(int argc, char **argv)
|
||
|
{
|
||
|
string c = "msh-console-test";
|
||
|
string ps = "[msh-console-test]:";
|
||
|
Shell mshConsoleTest(c, ps, &setup);
|
||
|
|
||
|
//add builtin commands
|
||
|
mshConsoleTest.addCmd(new Command("cd", &cdExecute));
|
||
|
mshConsoleTest.addCmd(new Command("exit", &exitExecute));
|
||
|
mshConsoleTest.addCmd(new Command("help", &helpExecute));
|
||
|
mshConsoleTest.launch();
|
||
|
return EXIT_SUCCESS;
|
||
|
}
|
||
|
|
||
|
void setup(Shell *s){
|
||
|
cout << "Now entering in test shell...\n" << endl;
|
||
|
s->executeCmd("stty -ctlecho");
|
||
|
}
|