Skip to content

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
@Nixinova Nixinova merged commit 6798cfe into main Feb 8, 2025
5 checks passed
@Nixinova Nixinova added the implemented This feature has been added label Feb 8, 2025
@Nixinova Nixinova deleted the feat/minSize branch February 20, 2025 09:42
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 implemented This feature has been added 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

2 participants