code: #  Copyright 2023 LanceDB Developers
  #
  #  Licensed under the Apache License, Version 2.0 (the "License");
  #  you may not use this file except in compliance with the License.
  #  You may obtain a copy of the License at
  #      http://www.apache.org/licenses/LICENSE-2.0
  #
  #  Unless required by applicable law or agreed to in writing, software
  #  distributed under the License is distributed on an "AS IS" BASIS,
  #  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  #  See the License for the specific language governing permissions and
  #  limitations under the License.
  
  import click
  
  from lancedb.utils import CONFIG
  
  
  @click.group()
  @click.version_option(help="LanceDB command line interface entry point")
  def cli():
      "LanceDB command line interface"
  
  
  diagnostics_help = """
  Enable or disable LanceDB diagnostics. When enabled, LanceDB will send anonymous events
  to help us improve LanceDB. These diagnostics are used only for error reporting and no
  data is collected. You can find more about diagnosis on our docs:
  https://lancedb.github.io/lancedb/cli_config/
  """
  
  
  @cli.command(help=diagnostics_help)
  @click.option("--enabled/--disabled", default=True)
  def diagnostics(enabled):
      CONFIG.update({"diagnostics": True if enabled else False})
      click.echo("LanceDB diagnostics is %s" % ("enabled" if enabled else "disabled"))
  
  
  @cli.command(help="Show current LanceDB configuration")
  def config():
      # TODO: pretty print as table with colors and formatting
      click.echo("Current LanceDB configuration:")
      cfg = CONFIG.copy()
      cfg.pop("uuid")  # Don't show uuid as it is not configurable
      for item, amount in cfg.items():
          click.echo("{} ({})".format(item, amount))
  
apis: lancedb.utils.CONFIG.copy lancedb.utils.CONFIG.update
extract_api: [((641, 654), 'click.group', 'click.group', ([], {}), '()\n', (652, 654), False, 'import click\n'), ((656, 727), 'click.version_option', 'click.version_option', ([], {'help': '"""LanceDB command line interface entry point"""'}), "(help='LanceDB command line interface entry point')\n", (676, 727), False, 'import click\n'), ((1131, 1181), 'click.option', 'click.option', (['"""--enabled/--disabled"""'], {'default': '(True)'}), "('--enabled/--disabled', default=True)\n", (1143, 1181), False, 'import click\n'), ((1212, 1270), 'lancedb.utils.CONFIG.update', 'CONFIG.update', (["{'diagnostics': True if enabled else False}"], {}), "({'diagnostics': True if enabled else False})\n", (1225, 1270), False, 'from lancedb.utils import CONFIG\n'), ((1275, 1360), 'click.echo', 'click.echo', (["('LanceDB diagnostics is %s' % ('enabled' if enabled else 'disabled'))"], {}), "('LanceDB diagnostics is %s' % ('enabled' if enabled else 'disabled')\n    )\n", (1285, 1360), False, 'import click\n'), ((1493, 1537), 'click.echo', 'click.echo', (['"""Current LanceDB configuration:"""'], {}), "('Current LanceDB configuration:')\n", (1503, 1537), False, 'import click\n'), ((1548, 1561), 'lancedb.utils.CONFIG.copy', 'CONFIG.copy', ([], {}), '()\n', (1559, 1561), False, 'from lancedb.utils import CONFIG\n')]