fiatjaf / module-linker

browse modules by clicking directly on "import" statements on GitHub
https://module-linker.fiatjaf.com/
MIT License
251 stars 20 forks source link

Detect files with no extension #22

Closed joeyespo closed 7 years ago

joeyespo commented 7 years ago

I just came across a file that uses #!/usr/bin/env node instead of a .js extension. It threw me off for a second because GitHub still syntax highlighted it, but no Module Linker links showed up.

I noticed the switch statement to detect the language. If there's no match, could main() also see if the first line begins with #!, and if it does, check that for common program names?

What are your thoughts of this approach?

AlexWayfer commented 7 years ago

Good case and good solution, I think.

fiatjaf commented 7 years ago

I like it. What are common program names besides node?

AlexWayfer commented 7 years ago

What are common program names besides node?

ruby, python (?, maybe something with 2 or 3), php, sh, bash… Any interpreted language, I guess :)