Fix proj dispatch requiring action param for list action.

This commit is contained in:
realaltffour 2020-04-13 18:19:37 +03:00
parent b41f7fe5df
commit c288e0a32c
No known key found for this signature in database
GPG Key ID: 7115CD2AC9A76A56
1 changed files with 17 additions and 13 deletions

View File

@ -55,7 +55,9 @@ void proj_rm(proj_args args) {
exit(1);
}
void proj_list(proj_args args) {}
void proj_list(proj_args args) {
std::cout << "Hello world";
}
proj_mod* proj_new() {
proj_mod* mod = new proj_mod{};
@ -84,18 +86,20 @@ void proj_dispatch(const std::vector<std::string>& arguments) {
}
/* Get action param. */
if (arguments.size() <= 1) {
std::cout << "No arguments passed to project action!" << std::endl;
exit(1);
}
auto type_action = std::string{""};
for (size_t i = 1; i < arguments.size(); i++) {
type_action += arguments[i];
type_action += " ";
}
type_action.pop_back();
args.action_param = type_action;
if (type_str == "add" || type_str == "rm") {
if (arguments.size() <= 1) {
std::cout << "No arguments passed to project action!" << std::endl;
exit(1);
}
auto type_action = std::string{""};
for (size_t i = 1; i < arguments.size(); i++) {
type_action += arguments[i];
type_action += " ";
}
type_action.pop_back();
args.action_param = type_action;
} else
args.action_param = "";
args.db = new DB();
loadDB(*args.db, ".db");