-
Notifications
You must be signed in to change notification settings - Fork 79
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
Added functionality to spellcheck tweets before sending them. #35
Conversation
…ould be a config option really.
…ould be a config option really.
Users should note this requires GNU/aspell to be installed. |
I suggest to make the response case-insensitive. I might, for example, type a lowercase |
@@ -67,6 +68,13 @@ def cli(ctx, config, verbose): | |||
@click.argument("text", callback=validate_text, nargs=-1) | |||
@click.pass_context | |||
def tweet(ctx, created_at, twtfile, text): | |||
"""spell check the tweet before sending, and let the user know!""" | |||
s = subprocess.check_output(["aspell","-a"],input=text,universal_newlines=True) if s.find("&") != -1: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think there's a line return missing here.
Done! I think.... |
"""spell check the tweet before sending, and let the user know!""" | ||
s = subprocess.check_output(["aspell","-a"],input=text,universal_newlines=True) | ||
if s.find("&") != -1: | ||
print("Theres a spelling mistake in your tweet:\n"+text+"\nWould you like to send it anyway? (Y/N)") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use click for input and output
"""spell check the tweet before sending, and let the user know!""" | ||
subprocessReturn = subprocess.check_output(["aspell", "-a"], input=text, universal_newlines=True) | ||
if subprocessReturn.find("&") != -1: | ||
click.echo("Theres a spelling mistake in your tweet:\n"+text+"\n") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Always place spaces between operators like +
and prefer str.format
instead of +
I think a generic pre-tweet hook as suggested by @timofurrer in #30 (comment) would be a better solution, instead of hardcoding this. |
As I mentioned earlier (#39 (comment)) I don’t want to get the main program bloated. Including a spell checker for those who need one would also be easily solvable via a plugin system using hooks. |
Can we close this PR until we have plugin system or a similar solution? |
Yes, closing this for now. |
This will be a config option once I figure out how to do that.
Informs the user that the tweet has a mistake in it, then asks them if they want to send it anyway.
In reference to - #30