cli icon indicating copy to clipboard operation
cli copied to clipboard

Automatically get language from file extension

Open muuvmuuv opened this issue 7 years ago • 5 comments

It would make it way more comfortable if I could just pass a file or files and the CLI grabs itself the file language.

muuvmuuv avatar Oct 24 '18 08:10 muuvmuuv

Strongly agree. There was some related work in Unibeautify core a while ago: https://github.com/Unibeautify/unibeautify/pull/152

lassik avatar Oct 24 '18 08:10 lassik

Unibeautify core has functions to get the language based on several criteria, including file extension. What are you trying to do with it in the CLI exactly?

stevenzeck avatar Oct 24 '18 19:10 stevenzeck

Avoid having to pass --language foo manually. It would be convenient and I can't think of any harm it would cause.

lassik avatar Oct 24 '18 19:10 lassik

The reason for passing the language is so users can beautify specific blocks of code. For example, they might want to beautify HTML code in a .php file.

I'm not against retrieving the language from the file extension if the user doesn't specify the language through --language.

stevenzeck avatar Oct 25 '18 19:10 stevenzeck

That is what I suggest. Using both, first get the language automatically and if the user set the flag use this language

Sent with GitHawk

muuvmuuv avatar Oct 27 '18 08:10 muuvmuuv