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

Add minSize option which moves small languages into other result #35

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Nixinova
Copy link
Owner

@Nixinova Nixinova commented Jul 23, 2024

An implementation of a minSize option, proposed here:

This allows filtering the output to only show languages with a resulting size greater than what the user inputs.

This is done by moving the results of these too-small languages to an other key and deleting the original results.

This may be too ad-hoc - for instance, maybe this should be a CLI-only option and the actual data isn't changed? Is the other key needed, or not?

For this reason this feature is not being committed straight to main and will sit as a pull request for proposal.


Feedback would be welcome on the best implementation for this feature.

Example console output with this feature implemented:

C:\Users\Nixinova\Documents\GitHub\Linguist>node bin -a .

 Analysed 47,664 B from 20 files with linguist-js

 Language analysis results:

   1. █ TypeScript               79.57%     37,924 B
   2. █ JavaScript               10.85%      5,172 B
   3. █ JSON                      9.01%      4,296 B
   4. █ INI                       0.57%        272 B

 Total: 47,664 B
C:\Users\Nixinova\Documents\GitHub\Linguist>node bin -a . --minSize 5KB

 Analysed 47,664 B from 20 files with linguist-js

 Language analysis results:

   1. █ TypeScript               79.57%     37,924 B
   2. █ JavaScript               10.85%      5,172 B
   3. █ other                     9.58%      4,568 B

 Total: 47,664 B

An implementation of a `minSize` option (proposed in #32).

This allows filtering the output to only show languages with a resulting size greater than what the user inputs.

This is done by moving the results of these too-small languages to an `other` key and deleting the original results.

This may be too ad-hoc - for instance, maybe this should be a CLI-only option and the actual data isn't changed? Is the `other` key needed, or not?

For this reason this feature is not being committed straight to main and will sit as a pull request for proposal.
@Nixinova Nixinova added enhancement New feature or request output Related to the output or display labels Jul 23, 2024
@Nixinova
Copy link
Owner Author

The diff is very readable if anyone interested in this feature wants to look at the methodology of doing this - https://github.com/Nixinova/LinguistJS/pull/35/files

@Nixinova Nixinova linked an issue Jul 23, 2024 that may be closed by this pull request
@Nixinova Nixinova added the help wanted Extra attention is needed label Aug 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request help wanted Extra attention is needed output Related to the output or display
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Feature request: allow filtering results with minBytes
1 participant