/**************************************************************************** Copyright (c) 2020, QuantStack and xeus-SQLite contributors ** ** ** Distributed under the terms of the BSD 3-Clause License. ** ** The full license is in the file LICENSE, distributed with this software. *****************************************************************************/#include <memory>#include <iostream>#include "xeus/xkernel.hpp"#include "xeus/xkernel_configuration.hpp"#include "xeus-sql/xeus_sql_interpreter.hpp"std::string extract_filename(int& argc, char* argv[]){std::string res = "";for (int i = 0; i < argc; ++i){if ((std::string(argv[i]) == "-f") && (i + 1 < argc)){res = argv[i + 1];for (int j = i; j < argc - 2; ++j){argv[j] = argv[j + 2];}argc -= 2;break;}}return res;}int main(int argc, char* argv[]){// Load configuration filestd::string file_name = extract_filename(argc, argv);// Create interpreter instanceusing interpreter_ptr = std::unique_ptr<xeus_sql::interpreter>;interpreter_ptr interpreter = std::make_unique<xeus_sql::interpreter>();// Create kernel instance and start it// xeus::xkernel kernel(config, xeus::get_user_name(), std::move(interpreter));// kernel.start();using history_manager_ptr = std::unique_ptr<xeus::xhistory_manager>;history_manager_ptr hist = xeus::make_in_memory_history_manager();if (!file_name.empty()){xeus::xconfiguration config = xeus::load_configuration(file_name);xeus::xkernel kernel(config,xeus::get_user_name(),std::move(interpreter),std::move(hist),xeus::make_console_logger(xeus::xlogger::msg_type,xeus::make_file_logger(xeus::xlogger::content, "xeus.log")),xeus::make_xserver_shell_main);std::clog <<"Starting xeus-sql kernel...\n\n""If you want to connect to this kernel from an other client, you can use"" the " + file_name + " file."<< std::endl;kernel.start();}else{xeus::xkernel kernel(xeus::get_user_name(),std::move(interpreter),std::move(hist),nullptr,xeus::make_xserver_shell_main);const auto& config = kernel.get_config();std::clog <<"Starting xeus-sql kernel...\n\n""If you want to connect to this kernel from an other client, just copy"" and paste the following content inside of a `kernel.json` file. And then run for example:\n\n""# jupyter console --existing kernel.json\n\n""kernel.json\n```\n{\n"" \"transport\": \"" + config.m_transport + "\",\n"" \"ip\": \"" + config.m_ip + "\",\n"" \"control_port\": " + config.m_control_port + ",\n"" \"shell_port\": " + config.m_shell_port + ",\n"" \"stdin_port\": " + config.m_stdin_port + ",\n"" \"iopub_port\": " + config.m_iopub_port + ",\n"" \"hb_port\": " + config.m_hb_port + ",\n"" \"signature_scheme\": \"" + config.m_signature_scheme + "\",\n"" \"key\": \"" + config.m_key + "\"\n""}\n```\n";kernel.start();}return 0;}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。