Skip to content

Commit 1a8cc89

Browse files
authored
Merge pull request #108 from akshgpt7/cli-improvements
Check for valid loader tag in load command
2 parents 6338d5a + 78698dd commit 1a8cc89

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

source/cli/metacallcli/source/application.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -377,6 +377,16 @@ bool command_cb_load(application &app, tokenizer &t)
377377
loader_tag = *it;
378378
}
379379

380+
std::string loaders[] = {
381+
"mock", "py", "node", "rb", "cs", "cob", "ts", "js", "file"
382+
};
383+
384+
// check if invalid loader tag
385+
if (std::find(std::begin(loaders), std::end(loaders), loader_tag) == std::end(loaders))
386+
{
387+
return false;
388+
}
389+
380390
do
381391
{
382392
++it;
@@ -759,6 +769,8 @@ void application::execute(tokenizer &t)
759769

760770
command_debug(*it, t);
761771

772+
std::cout << "See `help` for list of available commands" << std::endl;
773+
762774
return;
763775
}
764776

@@ -768,6 +780,8 @@ void application::execute(tokenizer &t)
768780

769781
command_debug(*it, t);
770782

783+
std::cout << "See `help` for correct usage" << std::endl;
784+
771785
return;
772786
}
773787
}

0 commit comments

Comments
 (0)