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

Added functionality to spellcheck tweets before sending them. #35

Closed
wants to merge 7 commits into from

Conversation

Samathy
Copy link

@Samathy Samathy commented Feb 7, 2016

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

@Samathy
Copy link
Author

Samathy commented Feb 7, 2016

Users should note this requires GNU/aspell to be installed.

@mkody
Copy link

mkody commented Feb 7, 2016

I suggest to make the response case-insensitive. I might, for example, type a lowercase y instead.

@@ -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:
Copy link

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.

@Samathy
Copy link
Author

Samathy commented Feb 7, 2016

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)")
Copy link
Contributor

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")
Copy link
Contributor

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 +

@jomo
Copy link

jomo commented Feb 8, 2016

I think a generic pre-tweet hook as suggested by @timofurrer in #30 (comment) would be a better solution, instead of hardcoding this.

@buckket
Copy link
Owner

buckket commented Feb 8, 2016

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.

@buckket buckket mentioned this pull request Feb 8, 2016
@timofurrer
Copy link
Contributor

Can we close this PR until we have plugin system or a similar solution?

@buckket
Copy link
Owner

buckket commented Feb 10, 2016

Yes, closing this for now.

@buckket buckket closed this Feb 10, 2016
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.

5 participants