0
Under review

Detection of file type by shebang line

Andrew Pearce 6 years ago updated by Alexander Blach (Developer) 6 years ago 1
I'm loving Textastic - really handy for editing files locally on my morning commute (with terrible reception) and then upload them on a decent 4G connection at the end.

I've just had one annoyance so far which is that detection of file type appears to go by the file extension only. The problem is that I commonly omit the extension for executable scripts (e.g. Python) so that the language is an implementation detail that can be changed later without needing to change anything that calls them.

It would be great if extensionless files could be detected based on Shebang line. So, if the first line of the file starts with #! and something like "python" or "ruby" occurs after it then the appropriate mode can be chosen. I suggest a loose parsing strategy like that to cope with different paths to interpreters, use of the "env" utility, etc.