arosspope/src2pdf

Infer source files and language thereof

alis0nc opened this issue · 2 comments

Perhaps something could be done with running file(1) on the whole directory to pick up what files are source files (as opposed to plain old text) and their language, instead of asking the user for the project language and source file extensions.

That does introduce a dependency on file(1) though, and your distribution's magic files, so it could lead to different behaviour on different Unixen.

Whilst I do think that this idea has merit, it would mean we would need to maintain some kind of mapping between file extensions, the output of file(1) and the languages the LaTeX source listings package knows about. Additionally (whilst it probably only applies to c/c++ and perhaps a moot point) some file extensions map to multiple languages, so it might be somewhat difficult to infer the desired language of the overall project.

If you can propose a method to overcome/implement this functionality, then I would be interested to hear it. Otherwise, I think letting the user choose the language makes the script simple and is the best path for now.