Skip to content

Commit

Permalink
fix(API): Ensure callback is a function (#271)
Browse files Browse the repository at this point in the history
Signed-off-by: Omar Mohamed <[email protected]>
  • Loading branch information
omar-mohamed-khallaf authored Nov 10, 2024
1 parent a5022a5 commit a0a7fad
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lua/cmake-tools/init.lua
Original file line number Diff line number Diff line change
Expand Up @@ -642,7 +642,7 @@ function cmake.launch_args(opt)
end

function cmake.select_build_type(callback)
callback = callback
callback = type(callback) == "function" and callback
or function(result)
if result:is_ok() then
cmake.generate({ bang = false, fargs = {} }, nil)
Expand Down Expand Up @@ -686,7 +686,7 @@ function cmake.select_build_type(callback)
end

function cmake.select_kit(callback)
callback = callback
callback = type(callback) == "function" and callback
or function(result)
if result:is_ok() then
cmake.generate({ bang = false, fargs = {} }, nil)
Expand Down Expand Up @@ -731,7 +731,7 @@ function cmake.select_kit(callback)
end

function cmake.select_configure_preset(callback)
callback = callback
callback = type(callback) == "function" and callback
or function(result)
if result:is_ok() then
cmake.generate({ bang = false, fargs = {} }, nil)
Expand Down Expand Up @@ -780,7 +780,7 @@ function cmake.select_configure_preset(callback)
end

function cmake.select_build_preset(callback)
callback = callback
callback = type(callback) == "function" and callback
or function(result)
if result:is_ok() then
cmake.generate({ bang = false, fargs = {} }, nil)
Expand Down Expand Up @@ -847,7 +847,7 @@ function cmake.select_build_preset(callback)
end

function cmake.select_build_target(regenerate, callback)
callback = callback or function() end
callback = type(callback) == "function" and callback or function() end
if not (config:has_build_directory()) then
-- configure it
return cmake.generate({ bang = false, fargs = {} }, function(result)
Expand Down

0 comments on commit a0a7fad

Please sign in to comment.