Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Not handling extensions #249

Open
maxpv opened this issue Nov 5, 2019 · 2 comments
Open

Not handling extensions #249

maxpv opened this issue Nov 5, 2019 · 2 comments
Labels

Comments

@maxpv
Copy link

maxpv commented Nov 5, 2019

After noticing that enry commands ignore files without extension, I Wrote a simple PHP file:

<?php 
	echo "Hello";
?>

Created files with the same content but different extensions:

.
├── hello.c
├── hello.css
├── hello.html
└── hello.sql

enry --breakdown returns:

39.02%  CSS
30.49%  C
30.49%  HTML

C
hello.c
CSS
hello.css
HTML
hello.html

Don't know if that's the desired output.

@bzz bzz added the question label Nov 17, 2019
@bzz
Copy link
Contributor

bzz commented Nov 17, 2019

Hi @maxpv this is the desired output at the current state due to the fact the enry works the same way as https://github.com/github/linguist#how-linguist-works

Basically you either need to specifically call a library API that would always check the content for possible (ambiguous) list of matching languages (e.g GetLanguageByClassifier or GetLanguageByContent that do not depend on file extension), otherwise if used though a high-level API - the first unambiguous strategy will be used, as it is done by CLI which in this case was a file extension.

I'll push a bit of the doc update on use cases, to make more clear soon.

@bzz
Copy link
Contributor

bzz commented Mar 31, 2020

Updated docs available at https://github.com/go-enry/go-enry#use-cases

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants