I created a POSIX shell script alternative to randomize.py #2
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.
I created a POSIX shell script alternative to randomize.py that should work on all Linux, BSD and macOS systems out of the box, no Python required.
I think this fits well with the "only use the standard c libraries" goal of the project by providing a portable alternative to the Python script.
Usage example:
Oh, and another thing. I can't help with this until I learn C, but on POSIX systems we have pipes, so I would like if typist could read the words from stdin so you could do something like this:
$ randomize.sh most_used_words.txt | typist -
(I would modify randomize.sh to output out of stdout by default.)
This is better because we don't have to write to the disk.
Another benefit: randomize.sh wouldn't overwrite the file, so you could pass it paths of text files without having to make a copy first.
It also gives us more extensibility and power.
For example, if you want a shorter test:
$ randomize.sh most_used_words.txt | head -1 | typist -
It keeps only the first line of the randomized text.
Or you could type a fortune cookie/quote:
$ fortune | typist -
Or a manual page:
$ man 1p sed | typist -