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 command-line flags #5

Merged
merged 1 commit into from
Nov 29, 2021
Merged

Add command-line flags #5

merged 1 commit into from
Nov 29, 2021

Conversation

tmck-code
Copy link
Owner

Context

Edging closer towards a useable cli tool, and not just a barebones POC

This adds some handy-dandy arguments to pokesay-go, initially these are just related to the text wrapping & formatting.
In particular, use -nowrap for a nice speed increase.

Changes

Usage of ./pokesay:
  -fastest
        run with the fastest possible configuration (-nowrap -notabspaces)
  -notabspaces
        do not replace tab characters (fastest)
  -nowrap
        disable text wrapping (fastest)
  -tabwidth int
        replace any tab characters with N spaces (default 4)
  -width int
        the max speech bubble width (default 80)
  • Added a -fastest flag which will switch all the flags to whatever the fastest mode is (if applicable)
    • currently it's equivalent to -nowrap -notabstop
    • -nowrap makes a nice difference
    • -notabstop is statistically insignificant, unless the size of the text is huge

Benchmarks

# test data:
# for i in {1..1000}; do fortune >> f.txt ; done

Summary
  'cat f.txt | ./pokesay -fastest' ran
    2.08 ± 0.27 times faster than 'cat f.txt | ./pokesay'
    2.37 ± 0.32 times faster than 'cat f.txt | $HOME/bin/pokesay'

```text
Usage of ./pokesay:
  -fastest
        run with the fastest possible configuration (-nowrap -notabspaces)
  -notabspaces
        do not replace tab characters (fastest)
  -nowrap
        disable text wrapping (fastest)
  -tabwidth int
        replace any tab characters with N spaces (default 4)
  -width int
        the max speech bubble width (default 80)
```
@tmck-code tmck-code merged commit b92eb71 into master Nov 29, 2021
@tmck-code tmck-code deleted the cli-flags branch November 29, 2021 13:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant