[tool] reading_time (#163)#214
Open
PurpleSwtr wants to merge 1 commit into
Open
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds the reading_time tool requested in #163.
Behavior
I implemented two ways to send text. (If this isn't suitable, I can easily fix it and remove this functionality.)
But I thought it would be convenient to also be able to send a file path to the tool, rather than, for example, pasting 5,000+ lines of text into the terminal.
It uses the standard Python method of redirecting input file using the "<" operator on the command line.
Examples
I used rounding by adding half the divisor.
(90 words): (90 + 100) // 200 -> 190 // 200 = 0 (rounded down, since it's less than half).
(110 words): (110 + 100) // 200 -> 210 // 200 = 1 (rounded up, since it's over the threshold).
(290 words): (290 + 100) // 200 -> 390 // 200 = 1 (rounded down, closer to 1).
(310 words): (310 + 100) // 200 -> 410 // 200 = 2 (rounded up, closer to 2).
python bitbox.py reading_time "text, < 100 words"->0python bitbox.py reading_time "text, = 100 words"->1python bitbox.py reading_time "text, = 200 words"->1python bitbox.py reading_time "text, = 400 words"->2and also i tested this on some files, this is the second way to use:
python bitbox.py reading_time < "README.md"->2(397 words) p.s. file of this projectpython bitbox.py reading_time < "1.md"->5(959 words)python bitbox.py reading_time < "2.md"->22(4469 words)Checklist
tools/directory# tool,# description,# author,# example)run()function that returns a stringpython bitbox.py <tool_name> <args>Closes #163