Skip to content

Commit

Permalink
Transfer tutorial as build in function
Browse files Browse the repository at this point in the history
  • Loading branch information
guptaprakhariitr committed May 9, 2021
1 parent 096455b commit e008052
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 8 deletions.
5 changes: 3 additions & 2 deletions include/builtin.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,10 @@ const std::vector<std::string> builtin_list{
"history",
"exit",
"roosh",
"google"};
"google",
"tutorial"};

int check_builtin(const std:: string &cmd);
int check_builtin(const std::string &cmd);
bool run_builtin(const std::string &cmd, int idx);
int roosh_cd(char **args, int num_args);
int roosh_history(char **args, int num_args);
Expand Down
4 changes: 3 additions & 1 deletion src/builtin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
#include "../include/parse.hpp"
#include "../include/launch.hpp"
#include "../include/google.hpp"
#include "../include/tutorial.hpp"

using namespace std;

Expand All @@ -23,7 +24,8 @@ int (*builtin_func[])(char **, int) = {
&roosh_history,
&roosh_exit,
&roosh_rsh,
&roosh_google};
&roosh_google,
&roosh_exec_tutorial};

// vector to store history of list of commands
vector<string> list_cmds;
Expand Down
5 changes: 0 additions & 5 deletions src/launch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,6 @@ using namespace std;
bool roosh_launch(const string &line)
{
vector<string> cmds = roosh_tokenizer(line, '|');
auto [args, num_args] = roosh_parse(line);
if (strcmp(args[0], "tutorial") == 0)
{
return roosh_exec_tutorial(args, num_args);
}
// take input for first command
// from a file if required
int in_fd = redirect_input(cmds[0]);
Expand Down

0 comments on commit e008052

Please sign in to comment.