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

error message printed to stderr, exit with error code on failure #14

Merged
merged 1 commit into from Feb 17, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 19 additions & 7 deletions stackit/stackit_core.py
Expand Up @@ -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):
Expand All @@ -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):
Expand All @@ -109,12 +111,15 @@ def _search(config):
print_question(question, count)
if count % NUM_RESULTS == 0:
focus_question(question_logs)

if not questions:
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PEP8: missing whitespace after ','

click.echo(
click.style("Your search \'{0}\' with tags \'{1}\' returned no results.".format(config.term,config.tag),
fg="red"))

click.echo(
Copy link
Contributor Author

Choose a reason for hiding this comment

The 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
Expand Down Expand Up @@ -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)
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I also add this error message when stackit is launched without arguments, let me know I you prefer another one


if __name__ == '__main__':
main()