Skip to content

Commit

Permalink
Add shebang support (#149)
Browse files Browse the repository at this point in the history
Co-authored-by: Arseny Kapoulkine <arseny.kapoulkine@gmail.com>
  • Loading branch information
Rerumu and zeux authored Dec 9, 2021
1 parent 2e6a209 commit 12ef94d
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CLI/FileUtils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,10 @@ std::optional<std::string> readFile(const std::string& name)
if (read != size_t(length))
return std::nullopt;

// Skip first line if it's a shebang
if (length > 2 && result[0] == '#' && result[1] == '!')
result.erase(0, result.find('\n'));

return result;
}

Expand Down

0 comments on commit 12ef94d

Please sign in to comment.