<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def main(active, upcoming, hiring, short, goto, platforms, time):
 """A CLI for active and upcoming programming challenges from various platforms"""


  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)