Skip to content

Commit

Permalink
feat(scripts): add file and folder checks in lua script
Browse files Browse the repository at this point in the history
  • Loading branch information
DorielRivalet committed Aug 4, 2023
1 parent 27e96f8 commit c3d6b33
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions scripts/rename_emails.lua
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@ local keep_email = '100863878+DorielRivalet@users.noreply.github.com'
local renamed_email = 'unknown@thisisaplaceholderemail.com'
local email_regex = '<(.-)>'

-- Check if the input folder exists
local input_folder_attributes = lfs.attributes(input_folder)
if not input_folder_attributes or input_folder_attributes.mode ~= "directory" then
error("Input folder does not exist")
end

-- Check if the input file exists
local input_file_attributes = lfs.attributes(input_file)
if not input_file_attributes or input_file_attributes.mode ~= "file" then
error("Input file does not exist")
end

-- Function to replace email addresses with <unknown@unknown.com>
local function replace_email(match)
-- Check if the matched email is the one to keep
Expand Down

0 comments on commit c3d6b33

Please sign in to comment.