Display synchronization information.

def info(path):
  ''' Display synchronization information. '''

  output, err = cli_syncthing_adapter.info(folder=path)

  if err:
    click.echo(output, err=err)
  else:
    stat = output['status']
    click.echo("State: %s" % stat['state'])
    click.echo("\nTotal Files: %s" % stat['localFiles'])
    click.echo("Files Needed: %s" % stat['needFiles'])
    click.echo("\nTotal Bytes: %s" % stat['localBytes'])
    click.echo("Bytes Needed: %s" % stat['needBytes'])

    progress = output['files_needed']['progress']
    queued = output['files_needed']['queued']
    rest = output['files_needed']['rest']

    if len(progress) or len(queued) or len(rest):
      click.echo("\nFiles Needed:")

    for f in progress:
      click.echo("  " + f['name'])

    for f in queued:
      click.echo("  " + f['name'])

    for f in rest:
      click.echo("  " + f['name'])

    click.echo("\nDevices Authorized:\n%s" % output['auth_ls'])