diff --git a/.gitmodules b/.gitmodules index f5e7bbc..9a28246 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,6 @@ [submodule "ofen"] path = ofen url = https://www.sinxmiao.cn/taynpg/ofen +[submodule "filecomplete"] + path = filecomplete + url = https://www.sinxmiao.cn/taynpg/filecomplete diff --git a/.vscode/settings.json b/.vscode/settings.json index a053d58..cb7812b 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -21,7 +21,7 @@ ], "visualizerFile": "${workspaceRoot}/.vscode/qt5.natvis", "args": [ - "-n", "0" + "-n", "2" ] }, "cmake.environment": { @@ -145,5 +145,6 @@ "text_encoding": "cpp", "*.in": "cpp" }, - "makefile.configureOnOpen": false + "makefile.configureOnOpen": false, + "C_Cpp.default.configurationProvider": "ms-vscode.cmake-tools" } \ No newline at end of file diff --git a/CMakeLists.txt b/CMakeLists.txt index d381627..e74cecf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -30,6 +30,7 @@ add_subdirectory(net) add_subdirectory(util) add_subdirectory(server) add_subdirectory(client) +add_subdirectory(filecomplete) string(TIMESTAMP VERSION_BUILD_DATE "%Y-%m-%d %H:%M") execute_process( diff --git a/client/CMakeLists.txt b/client/CMakeLists.txt index b8a043f..6b44926 100644 --- a/client/CMakeLists.txt +++ b/client/CMakeLists.txt @@ -8,7 +8,7 @@ if (MSVC) endif() add_executable(tsc main.cpp client.h client.cpp config.h config.cpp) -target_link_libraries(tsc PRIVATE trans_net trans_util) +target_link_libraries(tsc PRIVATE trans_net trans_util filecomplete) if (UNIX) target_link_libraries(tsc PRIVATE pthread) endif() diff --git a/client/client.cpp b/client/client.cpp index 3cc8783..8f7601b 100644 --- a/client/client.cpp +++ b/client/client.cpp @@ -67,16 +67,17 @@ void CClient::run(const std::string& ip, const std::string& port) delete bf; logger_->warn("SupportCmd:Get|Up|Down|Cancel|Update"); - char line[512]{}; - while (std::cin.getline(line, 512)) { + fc_append('|'); + while (1) { + char* readline = fc_readline(); if (!th_run_) { break; } - - std::string cmd_input(line); + std::string cmd_input(readline); + fc_free(readline); + std::cout << "" << std::endl; cmd_input = ofen::COfStr::trim(cmd_input); - if (cmd_input == "end") { th_run_ = false; std::this_thread::sleep_for(std::chrono::milliseconds(10)); diff --git a/client/client.h b/client/client.h index 0020872..ed4c3d6 100644 --- a/client/client.h +++ b/client/client.h @@ -7,6 +7,7 @@ #include #include #include +#include using namespace ofen; struct DownClientInfo { diff --git a/filecomplete b/filecomplete new file mode 160000 index 0000000..bbd0d6a --- /dev/null +++ b/filecomplete @@ -0,0 +1 @@ +Subproject commit bbd0d6a2471443e7d019f65207a072c1294b6fd7