<commit_before>import json

import fiona

import click
from cligj import indent_opt


@click.command()
@click.argument('input', type=click.Path(exists=True))
@indent_opt
def ls(input, indent):

    """
    List layers in a datasource.
    """

    result = fiona.listlayers(input)
    click.echo(json.dumps(result, indent=indent))<commit_msg>Enable logging in fio ls<commit_after>import json

import fiona

import click
from cligj import indent_opt


@click.command()
@click.argument('input', type=click.Path(exists=True))
@indent_opt
@click.pass_context
def ls(ctx, input, indent):

    """
    List layers in a datasource.
    """

    verbosity = (ctx.obj and ctx.obj['verbosity']) or 2

    with fiona.drivers(CPL_DEBUG=verbosity > 2):
        result = fiona.listlayers(input)
        click.echo(json.dumps(result, indent=indent))
{'fraction_non_alphanumeric': 0.12470023980815348, 'fraction_numerical': 0.002398081534772182, 'mean_word_length': 4.186335403726708, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 4, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '7342052', 'n_tokens_mistral': 288, 'n_tokens_neox': 272, 'n_words': 66}