@click.command()
@click.option('--active', is_flag=True, help="Shows all the active contests")
@click.option('--upcoming', is_flag=True, help="Shows all the upcoming contests")
@click.option('--hiring', is_flag=True, help="Shows all the hiring contests")
@click.option('--short', is_flag=True, help="Shows all the short contests")
@click.option('--platforms', '-p', multiple=True,
              help=("Choose the platform whose contests you want to see. "
                    "See platform codes for more info"))
@click.argument('goto', nargs=1, required=False, type=click.INT)
@click.option('--time', '-t', default=6,
              help="The number of days in the past for which you want to see the contests")
def main(active, upcoming, hiring, short, goto, platforms, time):

  if not check_platforms(platforms):
    raise IncorrectParametersException('Invlaid code for platform. Please check the platform ids')

  try:
    if active:
      active_challenges = active_contests(platforms)
      if goto:
        webbrowser.open(active_challenges[goto - 1]["contest_url"], new=2)
      else:
        writers.write_contests(active_challenges, "active")
      return

    if upcoming:
      upcoming_challenges = upcoming_contests(platforms, time)
      if goto:
        goto = int(goto)
        webbrowser.open(upcoming_challenges[goto - 1]["contest_url"], new=2)
      else:
        writers.write_contests(upcoming_challenges, "upcoming")
      return

    if hiring:
      hiring_challenges = hiring_contests()
      if goto:
        webbrowser.open(hiring_challenges[goto - 1]["contest_url"], new=2)
      else:
        writers.write_contests(hiring_challenges, "hiring")
      return

    if short:
      short_challenges = short_contests(platforms)
      if goto:
        goto = int(goto)
        webbrowser.open(short_challenges[goto - 1]["contest_url"], new=2)
      else:
        writers.write_contests(short_challenges, "short")
      return

    all_contests = get_all_contests(platforms, time)
    if goto:
      webbrowser.open(all_contests[goto - 1]["contest_url"], new=2)
    else:
      writers.write_contests(all_contests, "all")
  except IncorrectParametersException as e:
    click.secho(e.message, fg="red", bold=True)
Connection lost.
dataset/ETHPy150Open architv/chcli/challenges/cli.py/main--crossover with--dataset/ETHPy150Open byt3bl33d3r/pth-toolkit/lib/python2.7/site-packages/samba/external/subunit/__init__.py/_InTest.lostConnection