Skip to content

Commit

Permalink
Fixed some bugs in Toolkit (WIP)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sygmei committed Oct 2, 2018
1 parent 9496126 commit da33b4f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 12 deletions.
4 changes: 2 additions & 2 deletions CMakeLists.txt
Expand Up @@ -27,14 +27,14 @@ find_package(SFML 2.5 COMPONENTS system window graphics network audio REQUIRED)
# SFML is required by sfe (SFml Extensions)
add_subdirectory(extlibs/sfe)

configure_obengine_git()

add_subdirectory(src/Core)

if (NOT DEFINED BUILD_PLAYER)
set(BUILD_PLAYER ON CACHE BOOL "Build ObEngine Player ?")
endif()

configure_obengine_git()

if (BUILD_PLAYER)
add_subdirectory(src/Player)
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT ObEnginePlayer)
Expand Down
2 changes: 1 addition & 1 deletion cmake/engine_git.cmake
Expand Up @@ -42,7 +42,7 @@ function (configure_obengine_git)
)
string(REGEX MATCH "v(.+)\.(.+)\.(.+)$" GIT_OBENGINE_VERSION "${GIT_OBENGINE_VERSION_UNFORMATTED}")

set_git_version(${GIT_BRANCH} ${GIT_COMMIT_HASH} ${GIT_OBENGINE_VERSION})
set_git_version("${GIT_BRANCH}" "${GIT_COMMIT_HASH}" "${GIT_OBENGINE_VERSION}")
message("ÖbEngine Git version : ${OBENGINE_GIT_BRANCH}:${OBENGINE_GIT_COMMIT_HASH}")
message("ÖbEngine version : ${OBENGINE_VERSION}")
else()
Expand Down
23 changes: 14 additions & 9 deletions engine/Lib/Toolkit/Toolkit.lua
Expand Up @@ -10,6 +10,7 @@ function loadToolkitFunctions()
local fileList = obe.Filesystem.getFileList("Lib/Toolkit/Functions");
local allFunctions = {};
for _, content in pairs(fileList) do
print("Loading Toolkit function :", "Lib/Toolkit/Functions/", content);
allFunctions[String.split(content, ".")[1]] = require("Lib/Toolkit/Functions/" .. String.split(content, ".")[1]);
end
return allFunctions;
Expand Down Expand Up @@ -173,21 +174,19 @@ function splitCommandAndArgs(command)
end
if command:sub(#command, #command) == " " then
print("LAST PART OF COMMAND IS A SPACE");
table.insert(commandArgs, "");
strArgs = strArgs .. " ";
end
return { name = commandName, args = commandArgs, full = command, strArgs = strArgs };
end

function autocompleteHandle(command)
print("3°) Autocomplete handle called")
print("3-) Autocomplete handle called")
local autocompleteResult = command.full;
if #command.full > 0 then
if ToolkitFunctions[command.name] then
local strArgs = command.strArgs;
if command.full:sub(#command.full, #command.full) == " " then
strArgs = strArgs .. " ";
end
print("4°) StrArgs are : '" .. strArgs .. "'");
local completions = autocompleteArgs(ToolkitFunctions[command.name].Routes, strArgs);
print("4-) StrArgs are : '" .. command.strArgs .. "'");
local completions = autocompleteArgs(ToolkitFunctions[command.name].Routes, command.strArgs);
print("Got completions :", inspect(completions));
local completionKeys = Table.getKeys(completions)
if Table.getSize(completions) == 1 then
Expand All @@ -205,6 +204,12 @@ function autocompleteHandle(command)
elseif Table.getSize(completions) > 1 then
-- Multiple completions found, completing with biggest common root
print("Getting biggest common root");
local nodesOnly = {};
for k, v in pairs(completions) do
if v.type == "Node" then
nodesOnly[k] = v;
end
end
while autocompleteResult:sub(#autocompleteResult, #autocompleteResult) ~= " " do
print("Test equality : '" .. autocompleteResult:sub(#autocompleteResult, #autocompleteResult) .. "'");
print("Equalize to '" .. autocompleteResult:sub(1, -2) .. "'");
Expand Down Expand Up @@ -277,9 +282,9 @@ end

function autocomplete(input)
print("=============================================================")
print("1°) Called autocomplete with input :", input);
print("1-) Called autocomplete with input :", input);
local command = splitCommandAndArgs(input);
print("2°) Splitted input :", input, "to", inspect(command));
print("2-) Splitted input :", input, "to", inspect(command));
_term_last();
if ToolkitFunctions[command.name] then
if isUniqueValidCommand(command) then
Expand Down

0 comments on commit da33b4f

Please sign in to comment.