feat(furdb): add isocline for better command line

This commit is contained in:
2026-08-17 12:14:30 +02:00
parent ed84a65757
commit 1d4e8bb1d0
6 changed files with 23 additions and 8 deletions
+5 -4
View File
@@ -4,16 +4,16 @@ set -e
BUILD_DIR="build"
echo "Running clang-format..."
FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(cpp|hpp)$' || true)
FILES=$(git diff --cached --name-only --diff-filter=ACM | grep -E '\.(cpp|hpp)$' | grep -v 'deps/' || true)
if [ -z "$FILES" ]; then
echo "No C/C++ files to check"
exit 0
fi
git diff -U0 --cached | \
echo "Running clang-format..."
git diff -U0 --cached -- $FILES | \
python3 <(curl -s https://raw.githubusercontent.com/llvm/llvm-project/refs/heads/main/clang/tools/clang-format/clang-format-diff.py) -p1 -i
echo "Running clang-tidy..."
@@ -21,6 +21,7 @@ echo "Running clang-tidy..."
for file in $FILES; do
clang-tidy \
"$file" \
--header-filter="^(?!.*deps/).*" \
-p "$BUILD_DIR"
done
+3
View File
@@ -0,0 +1,3 @@
[submodule "furdb/deps/isocline"]
path = furdb/deps/isocline
url = https://github.com/daanx/isocline
+4 -1
View File
@@ -1,5 +1,8 @@
set(IC_USE_CXX ON)
add_subdirectory(${CMAKE_CURRENT_SOURCE_DIR}/deps/isocline)
file(GLOB_RECURSE FURDB_SRCS "src/**.cpp")
file(GLOB_RECURSE FURDB_HDRS "include/**.hpp")
add_executable(furdb ${FURDB_SRCS} ${FURDB_HDRS})
target_include_directories(furdb PRIVATE include/)
target_link_libraries(furdb PUBLIC furlang libfurc libfurvm)
target_link_libraries(furdb PUBLIC furlang libfurc libfurvm isocline)
+1
View File
@@ -0,0 +1 @@
Checks: '-*'
Submodule furdb/deps/isocline added at 8d6dc1ef95
+8 -2
View File
@@ -1,6 +1,7 @@
#include "command.hpp"
#include "context.hpp"
#include "furvm/function.hpp"
#include "isocline.h"
#include <fstream>
#include <furvm/fwd.hpp>
@@ -50,6 +51,8 @@ int main(int argc, char** argv) {
s_commands["break"] = s_commands["b"] = new break_command();
s_commands["info"] = s_commands["i"] = new info_command();
ic_set_history(nullptr, -1);
try {
std::ifstream file(argv[1], std::ios::binary | std::ios::in);
@@ -72,8 +75,11 @@ int main(int argc, char** argv) {
std::string prevInput;
while (ctx.running) {
std::swap(inputLine, prevInput);
std::cout << "(furdb) ";
if (!std::getline(std::cin, inputLine)) break;
char* inputRaw = ic_readline("furdb");
if (inputRaw == nullptr) break;
inputLine = inputRaw;
free(inputRaw); // NOLINT
if (inputLine.empty()) {
inputLine = prevInput;