-
Notifications
You must be signed in to change notification settings - Fork 28
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
error message printed to stderr, exit with error code on failure #14
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -69,7 +69,8 @@ def select(questions, num): | |
else: | ||
click.echo(click.style( | ||
"The input entered was not recognized as a valid choice.", | ||
fg="red")) | ||
fg="red", | ||
err=True)) | ||
|
||
|
||
def focus_question(questions): | ||
|
@@ -85,7 +86,8 @@ def focus_question(questions): | |
else: | ||
click.echo(click.style( | ||
"The input entered was not recognized as a valid choice.", | ||
fg="red")) | ||
fg="red", | ||
err=True)) | ||
|
||
|
||
def _search(config): | ||
|
@@ -109,12 +111,15 @@ def _search(config): | |
print_question(question, count) | ||
if count % NUM_RESULTS == 0: | ||
focus_question(question_logs) | ||
|
||
if not questions: | ||
click.echo( | ||
click.style("Your search \'{0}\' with tags \'{1}\' returned no results.".format(config.term,config.tag), | ||
fg="red")) | ||
|
||
click.echo( | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. PEP8: continuation line under-indented for visual indent |
||
click.style( | ||
"Your search \'{0}\' with tags \'{1}\' returned no results.".format(config.term, config.tag), | ||
fg="red", | ||
err=True)) | ||
sys.exit(1) | ||
|
||
|
||
def print_question(question, count): | ||
# questionurl gives the url of the SO question | ||
|
@@ -208,6 +213,13 @@ def main(config, search, stderr, tag, verbose, version): | |
_search(config) | ||
elif version: | ||
click.echo("Version {VERSION_NUM}".format(**globals())) | ||
else: | ||
click.echo( | ||
click.style( | ||
"No argument provided, use --help for help", | ||
fg="red", | ||
err=True)) | ||
sys.exit(1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I also add this error message when |
||
|
||
if __name__ == '__main__': | ||
main() |
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.
PEP8: missing whitespace after ','