MCPcopy Create free account
hub / github.com/Clarionos/clarion / run

Method run

libraries/fc/src/rpc/cli.cpp:89–126  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

87}
88
89void cli::run()
90{
91 while( !_run_complete.canceled() )
92 {
93 try
94 {
95 std::string line;
96 try
97 {
98 getline( _prompt.c_str(), line );
99 }
100 catch ( const fc::eof_exception& e )
101 {
102 break;
103 }
104 std::cout << line << "\n";
105 line += char(EOF);
106 fc::variants args = fc::json::variants_from_string(line);;
107 if( args.size() == 0 )
108 continue;
109
110 const string& method = args[0].get_string();
111
112 auto result = receive_call( 0, method, variants( args.begin()+1,args.end() ) );
113 auto itr = _result_formatters.find( method );
114 if( itr == _result_formatters.end() )
115 {
116 std::cout << fc::json::to_pretty_string( result ) << "\n";
117 }
118 else
119 std::cout << itr->second( result, args ) << "\n";
120 }
121 catch ( const fc::exception& e )
122 {
123 std::cout << e.to_detail_string() << "\n";
124 }
125 }
126}
127
128
129char * dupstr (const char* s) {

Callers

nothing calls this directly

Calls 8

to_pretty_stringFunction · 0.85
get_stringMethod · 0.80
to_detail_stringMethod · 0.80
c_strMethod · 0.45
sizeMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
findMethod · 0.45

Tested by

no test coverage detected