Skip to content

Commit

Permalink
tasks cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
matiasvlevi committed Aug 7, 2024
1 parent e3f93db commit e8217a0
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 7 deletions.
1 change: 0 additions & 1 deletion tasks/lib/components/Method.lua
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
local luax = require('tasks/lib/luax');


---
-- @Component
-- @props TMethod {
Expand Down
22 changes: 16 additions & 6 deletions tasks/lib/file.lua
Original file line number Diff line number Diff line change
@@ -1,10 +1,8 @@
function find_any(str)
return true;
end

function find_files_in_dir(directory, f)
if (f == nil) then
f = find_any
f = function (str)
return true;
end
end

local i, t, popen = 0, {}, io.popen
Expand All @@ -26,7 +24,19 @@ function write_file(path, content)
docs_file = io.open(path, "w");
docs_file:write(content);

print(#content .. ' bytes written in \x1b[90m' .. path .. '\x1b[0m');
-- Color based on file size
local color = '92';
local bytes = #content;
if (bytes > 1024 * 16) then
color = '91'
elseif (bytes > 1024 * 8) then
color = '93'
end

local fmt_size = '\x1b['.. color ..'m' ..
string.format("%.2f kB", bytes/1000) .. '\x1b[0m';

print(fmt_size .. ' written in \x1b[90m' .. path .. '\x1b[0m');
end

function read_file(path)
Expand Down

0 comments on commit e8217a0

Please sign in to comment.