MCPcopy Create free account
hub / github.com/daniele77/cli / Feed

Method Feed

include/cli/cli.h:912–941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

910 }
911
912 inline void CliSession::Feed(const std::string& cmd)
913 {
914 std::vector<std::string> strs;
915 detail::split(strs, cmd);
916 if (strs.empty()) return; // just hit enter
917
918 history.NewCommand(cmd); // add anyway to history
919
920 try
921 {
922 // global cmds check
923 bool found = globalScopeMenu->ScanCmds(strs, *this);
924
925 // root menu recursive cmds check
926 if (!found) found = current->ScanCmds(strs, *this);
927
928 if (!found) // wrong command handler if not found
929 cli.WrongCommandHandler(out, cmd);
930 }
931 catch(const std::exception& e)
932 {
933 cli.StdExceptionHandler(out, cmd, e);
934 }
935 catch(...)
936 {
937 out << "Cli. Unknown exception caught handling command line \""
938 << cmd
939 << "\"\n";
940 }
941 }
942
943 inline void CliSession::Prompt()
944 {

Callers

nothing calls this directly

Calls 5

splitFunction · 0.85
ScanCmdsMethod · 0.80
WrongCommandHandlerMethod · 0.80
StdExceptionHandlerMethod · 0.80
NewCommandMethod · 0.45

Tested by

no test coverage detected